Fungal endophytes are harboured in the leaves of every individual plant host and contribute to plant health, leaf senescence, and early decomposition. In grasslands, fungal endophytes and their hosts often coexist with large herbivores. However, the influence of grazing by large herbivores on foliar fungal endophyte communities remains largely unexplored. We conducted a long-term (18 yr) grazing experiment to explore the effects of grazing on the community composition and diversity of the foliar fungal endophytes of two perennial grassland species (i.e., Artemisia capillaris and Stipa bungeana) across one growing season. Grazing significantly increased the mean fungal alpha diversity of A. capillaris in the early season. In contrast, grazing significantly reduced the mean fungal alpha diversity of endophytic fungi of S. bungeana in the late season. Grazing, growing season, and their interactions concurrently structured the community composition of the foliar fungal endophytes of both plant species. However, growing season consistently outperformed grazing and environmental factors in shaping the community composition and diversity of both plant species. Overall, our findings demonstrate that the foliar endophytic fungal community diversity and composition differed in response to grazing between A. capillaris and S. bungeana during one growing season. The focus on this difference will enhance our understanding of grazing’s impact on ecological systems and improve land management practices in grazing regions. This variation in the effects of leaf nutrients and plant community characteristics on foliar endophytic fungal community diversity and composition may have a pronounced impact on plant health and plant–fungal interactions.