The invention relates to an unmanned aerial vehicle trajectory optimization and resource allocation method. The method comprises the following steps: S1, modeling an unmanned aerial vehicle trajectoryoptimization and resource allocation problem based on an unmanned aerial vehicle base station system; S2, planning an unmanned aerial vehicle trajectory optimization and resource allocation problem to ensure the fairness of unmanned aerial vehicle service for each user; S3, jointly optimizing the bandwidth and the power of the unmanned aerial vehicle under the condition of giving the track of theunmanned aerial vehicle; S4, optimizing the trajectory of the unmanned aerial vehicle under the condition of given bandwidth and unmanned aerial vehicle power; S5, comprehensively considering the S3and S4, and solving the problems of unmanned aerial vehicle trajectory optimization and resource allocation. According to the invention, the service quality of edge users, users blocked by obstacles and the like can be improved; bandwidth, power distribution and flight path of the unmanned aerial vehicle are optimized at the same time, so that the bandwidth, the power distribution and the flight path of the unmanned aerial vehicle are matched with one another, and communication efficiency of a communication system is greatly improved under limited communication resources.