Habitat selection in animals results from a careful balance of individual requirements, environmental conditions, and ecological disturbances. Preferences can vary across sexes and ages due to differences in survival and reproductive priorities. Despite this variability, most studies have traditionally focused on isolated aspects of either sex or age-related differences in habitat selection, rather than considering a comprehensive range of influencing factors. The mountain dragon lizard (Diploderma splendidum) exemplifies a species adapted to shrub habitats in the dry-hot river valleys of the lower Jinsha River, western China, playing a crucial role in regional ecosystem stability. In this study, we examined the influence of 11 ecological factors on habitat selection by male and female D. splendidum across two distinct age classes (juvenile and adult) to explore sex and age-related disparities. The lizards showed considerable similarity in habitat preferences, but notable differences in their selection of specific ecological factors. Compared to adult females, adult males displayed a preference for higher tree positions, lower light intensity, and moderate vegetation density. Compared to juvenile females, juvenile males favored higher tree positions, low rock formations, and shrubby grassland and forest. Compared to juvenile females, adult females preferred higher tree positions and habitats further from water. Compared to juvenile males, adult males preferred higher tree habitats. Overall, habitat selection complexity in D. splendidum was significantly influenced by sex and age factors. This study contributes to our understanding of how these lizards respond to different physiological structures and resource requirements. These findings enhance current knowledge on reptile habitat selection and provide theoretical insights crucial for ecological restoration and species protection in the hot and dry valley areas of Hengduan Mountain.