A physical model can be used to judge cementing quality to help drilling engineering. This article reports a physical model based on the XGboost algorithm to solve the cementing quality prediction problem of oil and gas wells. Through the physical model, the nonlinear, time-varying, and uncertain influencing factors, the high latitude of the data set, the lack of data, data imbalance and other characteristics are comprehensively analyzed. Finally, through numerical example verification, the physical model we reported can effectively predict the key factors affecting quality, improve process quality and reduce unit cost.