There are complex interrelationships between plant microorganisms (phyllosphere and rhizosphere) and host plants, which can promote plant growth and enhance the tolerance of host plants to stress. In this study, we selected the dominant species Bothriochloa ischaemum as the research subject in a copper tailings dam. Using high-throughput sequencing, we investigated the structures of the fungal communities and diversities in the phyllosphere and rhizosphere of B. ischaemum. This study also explored the effects of heavy metal content on fungal community characteristics. The results showed that Ascomycota and Basidiomycota were the dominant phyla in the phyllosphere and rhizosphere of B. ischaemum. The diversities and richness of the rhizosphere fungal community were higher than that of the phyllosphere fungal community. The diversities of rhizosphere and phyllosphere fungal communities was affected by different heavy metals. Phyllosphere fungal diversity was mainly affected by the content of Zn and Cu in leaves, and the content of Pb in roots was the key factor affecting the diversity of the rhizophere fungal community. Furthermore, Pleosporaceae had a very significant positive correlation with Cd in the phyllosphere, and Nectriaceae had a significant positive correlation with Zn in the rhizosphere. These fungal communities could be used as indicators of ecological recovery in areas with heavy metal pollution. The results could provide an ecological basis for the exploration and utilization of phyllosphere or rhizosphere fungi resources during ecological restoration processes. This study also provides guidance for selecting the plant-microbial symbionts during ecological restoration in areas with heavy metal pollution.