Abstract This paper firstly analyzes the network topology model of the UAV cluster network and wireless 5G communication channel model by modeling and briefly analyzes the idea of topology movement control for flying self-organized networks. Then, a cluster-based structure and reinforcement learning clustered routing protocol is proposed for the problem of easy breakage of routing forwarding paths caused by smart inspection of transmission lines based on UAV clusters for 5G communication. Finally, a cluster structure-based precedence routing protocol is designed, an adaptive routing protocol based on location and link quality Q-learning is used between clusters, and fast and reliable routing is achieved by combining the routing table maintained by itself. The simulation results show that ARP-L-Q (average end-to-end delay 4.22, average packet loss rate 88.09%, average packet rate 2.37, average control overhead 2.52) protocol performs better than GPSR and GACB protocols, and the experiment verifies that ARP-L-Q protocol can better achieve the high dynamic reconfiguration, high stability and reliability, and low communication delay of UAV cluster-based 5G communication network. Characteristics and requirements. This study has application prospects in both civil emergency and military mobile communication and has certain military significance, theoretical value and application value for thus promoting UAV innovation.