Understanding the determinants of urban–rural construction land transition is necessary for improving regional human–land relationships. This study analysed the spatiotemporal pattern of urban–rural construction land transition at the grid scale in the Yellow River Basin (YRB) of China during 2000–2020 by bivariate spatial autocorrelation analysis and further explored its determinants based on a machine learning method, the gradient boosted decision tree (GBDT) model. The results showed that both urban construction land (UCL) and rural residential land (RRL) increased, with an annual growth amount of UCL three times that of RRL, and the proportion of UCL (LUUR) remained stable after 2015. The determinants of UCL, RRL, and LUUR varied. The UCL mainly depended on socioeconomic factors, with their contribution exceeding 50%, while the RRL transition was mainly determined by physical geographic factors, with their contribution decreasing from 67.6% in 2000 to 59.7% in 2020. The LUUR was influenced by both socioeconomic and physical geographic factors, with the relative importance of socioeconomic factors increasing over the years. Meanwhile, the impacts of different determinants were nonlinear with a threshold effect. In the future, optimizing the distribution of urban–rural construction land and rationally adjusting its structure will be necessary for promoting urban–rural sustainability in the YRB.