With the rapid advancement of UAV technology and the increasing complexity of tasks, multi-UAV systems face growing challenges in task execution. Traditional task allocation algorithms often perform poorly when dealing with issues such as local optima, slow convergence speed, and low convergence accuracy, making it difficult to meet the demands for efficiency and practicality in real-world applications. To address these problems, this paper focuses on collaborative task allocation technology for multi-UAV. It proposes a collaborative task allocation strategy for multi-UAV in a multi-target environment, which comprehensively considers various complex constraints in practical application scenarios. The strategy utilizes Dubins curves for trajectory planning and constructs a multi-UAV collaborative task allocation model, with targets including the shortest total distance index, the minimum time index, and the trajectory coordination index. Each UAV is set as an artificial dragonfly by modifying the traditional dragonfly algorithm, incorporating differential evolution algorithms and their crossover, mutation, and selection operations to bring UAV swarms closer to the characteristics of biological dragonflies. The modifications can enhance the global scalability of artificial dragonfly swarms (ADSs), including wider search capacity, wider speed range, and more diverse search accuracy. Meanwhile, potential solutions with global convergence properties are stored to better support real-time adjustments to task allocation. The simulation results show that the proposed strategy can generate a conflict-free task execution scheme and plan the trajectory, which has advantages in changing the data scale of the UAV and the target and improves the reliability of the system to a certain extent.