ABSTRACT: Agriophyllum squarrosum (L.) Moq., a pioneer plant endemic to the temperate deserts of Asia, could be domesticated into an ideal crop with outstanding ecological and medicinal characteristics. A previous study showed differential flavonoid accumulation between two in situ altitudinal ecotypes. To verify whether this accumulation was determined by environmental or genetic factors, we conducted flavonoid-targeted metabolic profiling among 14 populations of A. squarrosum collected from regions with different altitudes based on a common garden experiment. Results showed that the most abundant flavonoid in A. squarrosum was isorhamnetin (48.40%, 557.45 μg/g), followed by quercetin (13.04%, 150.15 μg/g), tricin (11.17%, 128.70 μg/g), isoquercitrin (7.59%, 87.42 μg/g), isovitexin (7.20%, 82.94 μg/g), and rutin (7.00%, 80.62 μg/g). However, based on a common garden at middle-altitude environment, almost none of the flavonoids was enriched in the high-altitude populations, and even some flavonoids, such as quercetin, tricin, and rutin, were significantly enriched in low-altitude populations. This phenomenon indicated that the accumulation of flavonoids was not a result of local adaptation to high altitude. Furthermore, association analysis with in situ environmental variables showed that the contents of quercetin, tricin, and rutin were strongly positively correlated with latitude, longitude, and precipitation gradients and negatively correlated with temperature gradients. Thus, we could conclude that the accumulations of flavonoids in A. squarrosum were more likely as a result of local adaption to environmental heterogeneity combined with precipitation and temperature other than high altitude. This study not only provides an example to understand the molecular ecological basis of pharmacognosy, but also supplies methodologies for developing a new industrial crop with ecological and agricultural importance.