Dendrobium is an important medicinal plant, yet there is a significant variation in the medicinal efficacy among different species of Dendrobium. Endophytic microorganisms play a crucial role in determining the medicinal value of Dendrobium. This study focused on the two-year-old stems of 24 common Dendrobium species as experimental subjects, measuring the content of polysaccharides, total alkaloids, and total flavonoids in different Dendrobium species. High-throughput sequencing technology was employed to reveal the composition of endophytic bacterial and fungal communities within these 24 species of Dendrobium. Subsequently, the study analyzed the functions of Dendrobium endophytic microorganisms and the relationship between endophytic microorganisms and the accumulation of active substances. The research findings indicate that there are differences in the content of polysaccharides, alkaloids, and flavonoids among various Dendrobium species. There is also a significant variation in the composition of endophytic bacterial and fungal communities among different Dendrobium species, with Pseudomonas being the dominant bacterial species common to all 24 Dendrobium species. Random forest models and correlation analyses showed that the richness and diversity of endophytic bacteria are negatively correlated with the accumulation of Dendrobium polysaccharides, while the richness and diversity of endophytic fungi are positively correlated with the accumulation of Dendrobium alkaloids. Clostridium sensu stricto, Diaporthe, Cyphellophora, and Colletotrichum are related to the accumulation of effective components in Dendrobium. Endophytic bacteria, including Pseudomonas and Mesorhizobium, and endophytic fungi, including Fusarium and Aspergillus, are positively correlated with the accumulation of flavonoids. These findings provide a reference for the selection of microorganisms that promote the accumulation of effective substances in Dendrobium and for the exploitation of medicinal resources of Dendrobium.