Maintaining a healthy status is crucial for the successful captive breeding of critically endangered Rhinopithecus brelichi, it is conducive to ex situ conservation of this species and rejuvenation of its population. However, changes in the feeding environment and food can affect the composition and function of the gut microbiota in R. brelichi, ultimately impacting its health and adaptation. Herein, 16S rRNA gene sequencing was employed to determine the gut microbiota composition and functional variations between wild and captive R. brelichi populations. The results showed that the captive group had higher alpha diversity than the wild group, and significant differences were observed in their beta diversity. Captive and wild R. brelichi showed similar microbiota at the phylum level, which mainly comprised Firmicutes, Bacteroidota, and Spirochaetota, but captivity reduced the Firmicutes/Bacteroides ratio. LEfSe analysis revealed that the relative abundance of microbiota related to cellulose degradation, such as Prevotellaceae_UCG_001, Christensenellaceae_R_7_group, Ruminococcus, and Fibrobacter, differed significantly between the two groups. Furthermore, the potential pathogens Acinetobacter and Treponema were significantly abundant in wild and captive groups, respectively. Functional predictions demonstrated that the most significant functional pathways at the second level between captive and wild monkeys were carbohydrate, amino acid, and lipid metabolisms. The captive monkeys exhibited higher digestive capacity and endocrine regulation as well as a higher risk of infectious diseases than wild monkeys. These findings can serve as a valuable theoretical basis for promoting the healthy breeding of R. brelichi and as a guide for future evaluation of the health of wild and captive monkeys.