To study the feasibility of simulating the spatial distribution of hydrogen and oxygen stable isotopes composition (δ2H and δ18O) in the surface soil based on the machine learning method and to investigate large-scale distribution of δ2H and δ18O in the upper reaches of Minjiang River, 183 soil samples were collected from the 0-10 cm soil layer. After variable selection, back propagation (BP) neural network, random forests (RF) and support vector machine (SVM) were used to model the δ2H and δ18O of the study area, with the accuracies being evaluated. The structural equation model (SEM) was used to reveal the mechanism between the auxiliary variables and the δ2H and δ18O of soil water. The results showed that the RF model had the highest prediction accuracy, and could explain 75.0% and 64.0% of the variations of δ2H and δ18O in the surface soil, respectively. In this model, soil water content was the most important auxiliary variable, contributing 48.9% and 37.4% to δ2H and δ18O. Vegetation factors had stronger influence on δ2H and δ18O in the surface soil than climate factors, and the influence of climate factors on δ2H and δ18O was media-ted by vegetation factors. Among all the auxiliary variables, hydrogen/oxygen isotope of precipitation had the lowest effect on δ2H and δ18O due to the fractionation. The δ2H and δ18O in the surface soil of the upper reaches of the Minjiang River changed significantly across different months during the growing season. The increases of δ2H and δ18O in the early growing season and the decreases in the late growing season were mainly affected by vegetation, while climate change led to a small fluctuation in the middle growing season.