Aiming at the complex environment, unexpected situations, and multi-constraint problems faced by unmanned aerial vehicle (UAV) mission planning systems in dynamic scenes, an online task allocation method based on improved dynamic ant colony labor division (IDACLD) is proposed. The typical scene of multi-UAV task allocation is described, and a heterogeneous multi-UAV multi-constraint model is established via multigroup settings. According to this framework, the environmental stimulus and response thresholds of the dynamic ant colony division of labor model are redesigned, the coupling between task allocation and path planning is considered, and the RRT* algorithm is used to complete path cost estimation, which makes the task allocation result more reasonable in environments containing obstacles. Considering cases involving UAV faults, this study proposes different fault handling strategies to distinguish different fault types and better fit the actual situation of UAV missions. Simulation results demonstrate that the proposed method can quickly and effectively solve the task allocation problem of multiple UAVs in a dynamic environment.