Clinical studies focusing on the association between the gut microbiota and obstructive sleep apnea (OSA) are limited. This study aimed to explore the relationship between intermittent hypoxia and the composition of gut microbiota in adults by analyzing the differences in the characteristics and functional distribution of gut microbiota between patients with different severities of OSA and healthy individuals. A cohort of 113 individuals from the First Affiliated Hospital of Sun Yat-sen University underwent overnight polysomnography from July 2019 to August 2021. The individuals included 16 healthy controls and 97 patients with OSA, categorized by the apnea-hypopnea index into mild, moderate, and severe groups. Fecal samples were analyzed using high-throughput sequencing of the 16S rRNA V3-V4 region to assess gut microbiota composition and function. Correlation analysis was used to evaluate the association between clinical indicators and microbiota markers. In patients with OSA, the gut microbiota diversity and the abundance of specific microbes that produce short-chain fatty acids decreased (P<0.05). The phyla Verrucomicrobia and Candidatus Saccharibacteria, genera Gemmiger and Faecalibacterium, and the species Gemmiger formicilis exhibited decreasing abundance with increasing OSA severity. Correlation analysis revealed a robust association between the proportion of total sleep time, characterized by nighttime blood oxygen saturation below 90%, and the alterations in the gut microbiota, demonstrating that elevated levels of desaturation are correlated with pronounced microbiota dysbiosis (P<0.05). Compared to the control group, the intermittent hypoxia exhibited by patients with OSA may be related to alterations in the composition and structure of the gut microbiota. Our results demonstrate the importance of monitoring hypoxia indicators in future clinical practice.