BackgroundTo explore the community composition and diversity of the endophytic fungi inTaxillus chinensis, samples of the parasites growing on seven different hosts,Morus alba,Prunus salicina,Phellodendron chinense,Bauhinia purpurea,Dalbergia odorifera,Diospyros kakiandDimocarpus longan, were isolated. The strains were identified by their morphological characteristics and their internal transcribed spacer (ITS) sequences.Results150 different endophytic fungi were isolated from the haustorial roots of the seven hosts with a total isolation rate of 61.24%. These endophytic fungi were found to belong to 1 phylum, 2 classes, 7 orders, 9 families, 11 genera and 8 species. Among of them,Pestalotiopsis,NeopestalotiopsisandDiaporthewere the dominant genera, accounting for 26.67, 17.33 and 31.33% of the total number of strains, respectively. Diversity and similarity analyses showed that the endophytic fungi isolated fromD. longan(H’=1.60) had the highest diversity index. The highest richness indexes were found inM. albaandD. odorifera(both 2.23). The evenness index ofD. longanwas the highest (0.82). The similarity coefficient ofD. odoriferawas the most similar toD. longanandM. alba(33.33%), while the similarity coefficient ofP. chinensewas the lowest (7.69%) withM. albaandD. odorifera. Nine strains showed antimicrobial activities. Among them,Pestalotiopsis sp., N. parvumandH. investiensshowed significant antifungal activity against three fungal phytopathogens of medicinal plants. At the same time, the crude extracts from the metabolites of the three endophytic fungi had strong inhibitory effects on the three pathogens.Pestalotiopsis sp., N. parvumandH. investienshad the strongest inhibitory effects ofS. cucurbitacearum, with inhibitory rates of 100%, 100% and 81.51%, respectively. In addition,N. parvumhad a strong inhibitory effect onD. glomerataandC. cassicola, with inhibitory rates of 82.35% and 72.80%, respectively.ConclusionsThese results indicate that the species composition and diversity of endophytic fungi in the branches ofT. chinensiswere varied in the different hosts and showed good antimicrobial potential in the control of plant pathogens.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12866-023-02878-x.