Abstract:[Objective] To explore the differences and potential associations of endophytic microbial communities in different niches of chili pepper and provide a theoretical basis for the exploration and application of endophytic microbial resources in chili pepper. [Methods] The 16S rRNA and internal transcribed spacer (ITS) genes sequencing were employed to study the community structure characteristics of endophytic bacteria and fungi in different ecological niches (roots, stems, leaves, and fruits) of 91 pepper germplasm accessions, along with functional annotations. Additionally, co-occurrence network analysis and traceability analysis were performed on the endophytic bacterial communities. [Results] The operational taxonomic unit (OTU) of endophytic microbial communities were highly common among the four ecological niches, including 46.36% common bacterial OTUs and 29.66% common fungal OTUs. The diversity of endophytic bacterial and fungal communities in chili pepper exhibited variations across different ecological niches, with the endophytic communities in roots being distinctly separated from those in the other three niches (P<0.05). The Shannon index of endophytic bacteria varied significantly among niches, whereas that of endophytic fungi remained relatively stable. The dominant endophytic bacteria in chili pepper were Proteobacteria, Firmicutes, and Bacteroidota, with Proteobacteria being enriched in the roots and Firmicutes and Bacteroidetes being predominant in the fruits. Ascomycota and Basidiomycota, the dominant endophytic fungal phyla, exhibited minimal differences in relative abundance across the four ecological niches. Functional annotation results indicated that chili pepper harbored various endophytic bacteria capable of synthesizing secondary metabolites and antibiotics. Within the fungal community, pathogenic fungi were found to have the highest relative abundance. Additionally, more than 80.0% of the endophytic bacteria in chili pepper originated from their directly associated morphologically lower niches, exhibiting complex interaction networks, strong community stability, and a modular structure. [Conclusion] Compared with the endophytic fungal community, the endophytic bacterial community in chili pepper is sensitive to changes in ecological niches, while the niche specificity of the fungi is comparatively weak. The endophytic bacteria associated with each niche of chili pepper primarily originate from the niche located beneath, exhibiting significant niche enrichment, where the roots serving as a crucial source in shaping the endophytic bacterial community.