Differences in resource use among ungulates with similar ecological needs affect their stable coexistence. Forest musk deer (
Moschus berezovskii) and roe deer (
Capreolus pygargus) have extensive overlapping distributions in North and Southwest China, which are suitable for studying niche differentiation among small and medium-sized browsers. In this study, we used noninvasive sampling and DNA metabarcoding techniques to investigate the dietary composition and habitat utilization of these two ungulates in the Lyuliang Mountains. We identified a total of 94 families, 178 genera, and 118 species from their diets. Using the Pianka index, based on the relative abundance of genus-level operational taxonomic units (OTUs), we found significant dietary differentiation between the two species (
Oik=0.31,
P<0.001). This suggests that niche separation primarily occurs at the genus level of their selected dietary plants. The Shannon index, Pielou evenness index, and niche breadth index of dietary species were higher in the forest musk deer than the roe deer. In terms of spatial utilization, the two ungulates tended to use different microhabitats, particularly in slopes. In conclusion, the forest musk deer and the roe deer in the Lyuliang Mountains showed significant differences in spatial and dietary utilization patterns, which has likely contributed to their stable coexistence.