Studying the diversity of gut microbiota and antibiotic resistance genes (ARGs) in endangered migratory birds, as well as their responses to different environments, can reflect the health status of migratory birds and the ecological risk of ARG transmission. The globally endangered Scaly-sided merganser (Mergus squamatus) is a typical migratory bird, yet the diversity of its intestinal microbiota and ARGs has not been reported. In this study, fecal samples were collected from two major riparian foraging areas utilized by M. squamatus in the Changbai Mountains of China: the Lushui River and the Manjiang River. The gut microbiota and ARG composition were characterized using 16S rRNA amplicon and metagenomic sequencing. The results indicated that the relative abundance of gut microbiota in the two habitats differed significantly, but the core flora was similar. Moreover, the relative abundance of pathogenic bacteria was high, suggesting that M. squamatus faces a high risk of disease. A total of 382 ARGs were identified, which were primarily resistant to multidrug, tetracycline, macrolides-lincosamides-streptogramins, and mupirocin. MsbA, abcA, rpoB2, and tetT were the most abundant shared ARGs between the two sites. The findings demonstrate that habitat influences the diversity of gut microbiota and ARGs in the endangered migratory M. squamatus. This species could serve as a reservoir for pathogenic bacteria and ARGs. Therefore, monitoring the diversity of gut microbiota and ARGs in M. squamatus across different habitats is essential for a comprehensive assessment of its health status and the ecological risk of ARG transmission in the future.