Bleeding is a serious complication following percutaneous nephrolithotomy (PCNL). This study establishes a predictive model based on machine learning algorithms to forecast the occurrence of postoperative bleeding complications in patients with renal and upper ureteral stones undergoing lateral decubitus PCNL. We retrospectively collected data from 356 patients with renal stones and upper ureteral stones who underwent lateral decubitus PCNL in the Department of Urology at Peking University First Hospital-Miyun Hospital, between January 2015 and August 2022. Among them, 290 patients had complete baseline data. The data was randomly divided into a training group (n = 232) and a test group (n = 58) in an 8:2 ratio. Predictive models were constructed using Logistic Regression, Random Forest, and Extreme Gradient Boosting (XGBoost). The performance of each model was evaluated using Accuracy, Precision, F1-Score, Receiver Operating Characteristic curves, and Area Under the Curve (AUC). Among the 290 patients, 35 (12.07%) experienced postoperative bleeding complications after lateral decubitus PCNL. Using postoperative bleeding as the outcome, the Logistic model achieved an accuracy of 73.2%, AUC of 0.605, and F1 score of 0.732. The Random Forest model achieved an accuracy of 74.5%, AUC of 0.679, and F1 score of 0.732. The XGBoost model achieved an accuracy of 68.3%, AUC of 0.513, and F1 score of 0.644. The predictive model for postoperative bleeding after lateral decubitus PCNL, established based on machine learning algorithms, is reasonably accurate. It can be utilized to predict postoperative stone residue and recurrence, aiding urologists in making appropriate treatment decisions.