Unmanned aerial vehicles (UAVs) have developed rapidly in the military field. UAVs can play a role in the strike mission. However, UAVs can not complete the strike mission alone due to their limited bomb load. Multiple UAVs are often required to complete the strike mission together. In the process of task implementation, the weights of different goals are also very different. In order to maximize the strike effect, it is necessary to find out the optimal task to allocate the task. In order to solve the optimal task allocation problem of heterogeneous UAV attacking the opposite target, genetic algorithm is used to solve the optimal task allocation scheme. By modeling the task allocation model, the fitness function of genetic algorithm is obtained. Finally, the simulation results show that the genetic algorithm can effectively solve the task allocation problem of heterogeneous UAV attacking the opposite target.