The Yellow River Basin (YRB) is a crucial ecological zone and an environmentally vulnerable region in China. Understanding the temporal and spatial trends of terraced-field areas (TRAs) and the factors underlying them in the YRB is essential for improving land use, conserving water resources, promoting biodiversity, and preserving cultural heritage. In this study, we employed machine learning on the Google Earth Engine (GEE) platform to obtain spatial distribution images of TRAs from 1990 to 2020 using Landsat 5 (1990–2010) and Landsat 8 (2015–2020) remote sensing data. The GeoDa software (software version number is 1.20.0.) platform was used for spatial autocorrelation analysis, revealing distinct spatial clustering patterns. Mixed linear and random forest models were constructed to identify the driving force factors behind TRA changes. The research findings reveal that TRAs were primarily concentrated in the upper and middle reaches of the YRB, encompassing provinces such as Shaanxi, Shanxi, Qinghai, and Gansu, with areas exceeding 40,000 km2, whereas other provinces had TRAs of less than 30,000 km2 in total. The TRAs exhibited a relatively stable trend, with provinces such as Gansu, Qinghai, and Shaanxi showing an overall upward trajectory. Conversely, Shanxi and Inner Mongolia demonstrated an overall declining trend. When compared with other provinces, the variations in TRAs in Ningxia, Shandong, Sichuan, and Henan appeared to be more stable. The linear mixed model (LMM) revealed that farmland, shrubs, and grassland had significant positive effects on the TRAs, explaining 41.6% of the variance. The random forest model also indicated positive effects for these factors, with high R2 values of 0.984 and 0.864 for the training and testing sets, respectively, thus outperforming the LMM. The findings of this study can contribute to the restoration of the YRB’s ecosystem and support sustainable development. The insights gained will be valuable for policymaking and decision support in soil and water conservation, agricultural planning, and environmental protection in the region.