The multi-UAV task allocation problem can be divided into two components: optimising UAV resource allocation and developing an optimal execution plan. Existing single-population algorithms often get trapped in local optima and require improved accuracy. Although multi-population algorithms perform better, they introduce higher complexity, significantly increasing running time. This paper proposes a Two-Stage Multi-Population Wolf Pack Algorithm (2SMPWPA) to address these issues. This algorithm innovatively splits the task allocation problem into two stages: the initial stage focuses on optimising UAV resource utilisation. In contrast, the subsequent stage focuses on optimising the execution plans for the existing UAV resources. Furthermore, the algorithm categorises the population into a leader group and two normal groups, where the leader group consists of elite individuals from the ordinary groups. To ensure the outstanding individuals in the normal groups have adequate computational resources, a population competition mechanism is introduced to dynamically adjust the size of each sub-population based on their average contribution to the optimal solution. To prevent the ‘big eats small’ scenario, the algorithm incorporates population protection and migration mechanisms to maintain diversity. Additionally, a population communication mechanism is implemented to preserve ‘vitality’ during the later iterations, preventing the algorithm from converging to local optima. Comparative experiments demonstrate that the 2SMPWPA significantly outperforms recent algorithms regarding solution accuracy, effectively addressing the trade-off between solution precision and running time.