Most of the current task allocation of edge computing in intelligent coal mine uses centralized allocation algorithms, which takes a single factor into account when prioritizing tasks and does not consider the narrow and long characteristics of the coal mine network topology. In order to solve this problem, combined with the characteristics of tasks in coal mine scenarios, an edge computing task allocation strategy based on dynamic priority and real-time bidding strategy is proposed. The tasks are classified into different levels. On the one hand, tasks that exceed the computing capacity of edge nodes are directly uploaded to the cloud for processing. On the other hand, the tasks that can be processed at the edge computing layer are classified into three levels according to their importance. Level 1 is for tasks related to environmental monitoring and staff safety operation protocol detection. Level 2 is for tasks related to production process equipment status monitoring. And level 3 is for other routine tasks. However, allocating tasks according to these 3 levels alone can cause low priority tasks to be blocked by high priority tasks. The urgency of the task must be considered as well so that the tasks approaching the deadline are given higher priority. The priority is dynamically generated and the task queue is updated according to the fixed priority, urgency and calculation amount of the task. According to the characteristics of narrow and long underground coal mine roadways and restricted transmission, a real-time bidding model for task allocation is established. The quotation of the edge node for tasks is determined by four factors, including computing capacity, processing time, energy consumption and waiting time of the edge node. The requesting node transmits the task to the edge node that has the lowest processing cost within 2 hops and satisfies the task demand for execution, thereby completing task allocation. The simulation results show that the proposed task allocation strategy can allocate tasks to edge nodes with matching computing power for processing, so that edge nodes can process urgent and important tasks first. The method achieves better results in reducing delay and energy consumption, and optimizing resource allocation.