Apple rust, caused by Gymnosporangium yamadae, poses a significant challenge to apple production. Prior studies have underscored the pivotal role played by endophytic microbial communities, intimately linked with the host, in influencing plant diseases and their pathogenic outcomes. The objective of this study is to scrutinize alternations in endophytic microbial communities within apple leaves at different stages of apple rust using high-throughput sequencing technology. The findings revealed a discernible pattern characterized by an initial increase and subsequent decrease in the alpha diversity of microbial communities in diseased leaves. A microbial co-occurrence network analysis revealed that the complexity of the bacterial community in diseased leaves diminished initially and then rebounded during the progression of the disease. Additionally, employing the PICRUSt2 platform, this study provided preliminary insights into the functions of microbial communities at specific disease timepoints. During the spermogonial stage, endophytic bacteria particularly exhibited heightened activity in genetic information processing, metabolism, and environmental information processing pathways. Endophytic fungi also significantly enriched a large number of metabolic pathways during the spermogonial stage and aecial stage, exhibiting abnormally active life activities. These findings establish a foundation for comprehending the role of host endophytes in the interaction between pathogens and hosts. Furthermore, they offer valuable insights for the development and exploitation of plant endophytic resources, thereby contributing to enhanced strategies for managing apple rust.