To investigate the variation in flavonoids content in ancient tree sun–dried green tea under abiotic stress environmental conditions, this study determined the flavonoids content in ancient tree sun−dried green tea and analyzed its correlation with corresponding factors such as the age, height, altitude, and soil composition of the tree. This study uses two machine−learning models, Least Absolute Shrinkage and Selection Operator (LASSO) regression and Cox regression, to build a predictive model based on the selection of effective variables. During the process, bootstrap was used to expand the dataset for single−factor and multi−factor comparative analyses, as well as for model validation, and the goodness−of−fit was assessed using the Akaike information criterion (AIC). The results showed that pH, total potassium, nitrate nitrogen, available phosphorus, hydrolytic nitrogen, and ammonium nitrogen have a high accuracy in predicting the flavonoids content of this model and have a synergistic effect on the production of flavonoids in the ancient tree tea. In this prediction model, when the flavonoids content was >6‰, the area under the curve of the training set and validation set were 0.8121 and 0.792 and, when the flavonoids content was >9‰, the area under the curve of the training set and validation set were 0.877 and 0.889, demonstrating good consistency. Compared to modeling with all significantly correlated factors (p < 0.05), the AIC decreased by 32.534%. Simultaneously, a visualization system for predicting flavonoids content in ancient tree sun−dried green tea was developed based on a nomogram model. The model was externally validated using actual measurement data and achieved an accuracy rate of 83.33%. Therefore, this study offers a scientific theoretical foundation for explaining the forecast and interference of the quality of ancient tree sun−dried green tea under abiotic stress.