Habitat is fundamental for facilitating various life activities in animals, for instance, snakes procure essential energy for survival and reproduction by selecting ambush microhabitats. While there has been extensive research on the selection of microhabitat for feeding in terrestrial and aquatic snakes, little is known about arboreal snakes. In the present study, we analyzed the ambush microhabitat preferences of Viridovipera stejnegeri, a widely distributed Asian pitviper in China, conducted association analysis between snake microhabitat and prey microhabitat and abundance to determine the ro5le of microhabitat selection in feeding. Employing random forest analysis and habitat selection functions, we further constructed a predictive framework for assessing the probability of ambush site selection by V. stejnegeri. Our results revealed that V. stejnegeri exhibited a distinct microhabitat preference for ambush prey. Among the 13 environmental factors assessed, V. stejnegeri showed pronounced preferences towards 12 of these factors, including climatic factors, geographical factors, and vegetation factors. Furthermore, although the preferences of V. stejnegeri overlapped substantially with those of its prey across multiple habitat factors, food abundance shows no significant association with various habitat factors of V. stejnegeri, and does not have significant predictive effect on habitat selection of V. stejnegeri. Therefore, we infer that V. stejnegeri does not preferentially select microhabitats with the highest food abundance, which does not support the hypothesis that "snakes select habitats based on the spatial distribution of prey abundance." By analyzing the characteristics of vegetation, geography, and climate, we conclude that V. stejnegeri tends to choose microhabitats with better ambush conditions to increase attack success rate, thereby achieving the optimal feeding success rate at the microhabitat scale, which is in line with the predictions of optimal foraging theory. This study provides new insights into the predation ecology and habitat selection of snakes.