Insect-associated fungi are a potentially rich source of novel natural products with antibacterial activity. Here, we investigated the community composition and phylogenetic diversity of gut-associated fungi of the dragonfly (Crocothemis Servilia) using a combination of culture-dependent and culture-independent methods. A total of 42 fungal isolates were obtained from the guts of the dragonfly, which belonged to four classes and thirteen different genera. Amplicon sequencing analyses revealed that the fungal communities were more diverse, and a total of 136 genera were identified and dominated by the genera Wojnowiciella and Phoma. The antibacterial bioassay showed that five fungal crude extracts of representative isolates have shown antibacterial activities. Among them, the extract of Phoma sp. QTH17 showed the best antibacterial activities against Escherichia coli, Micrococcus tetragenus, and Staphylococcus aureus with the disc diameter of inhibition zone diameter (IZD) of 6.50, 10.80, and 8.70 mm, respectively. Chemical analysis of Phoma sp. QTH17 led to the discovery of five known compounds, including ergosterol (1), 3-Chlorogentisyl alcohol (2), epoxydon (3), epoxydon 6-methylsalicylate ester (4) and mannitol (5). Among them, the compound 3 exhibited potent antibacterial activities against E. coli, M. tetragenus, and S. aureus with the IZD of 7.00, 14.00, and 12.50 mm, respectively, which were slightly weaker than those of the positive gentamicin sulfate with the IZD of 11.13, 18.30, and 12.13 mm, respectively. In conclusion, our results confirmed that the diversity of gut-associated fungi of C. Servilia could be expected to explore the resource of new species and antibacterial substances.