Background Ureteral injury (UI) is a rare but devastating complication during colorectal surgery. Ureteral stents may reduce UI but carry risks themselves. Risk predictors for UI could help target the use of stents, but previous efforts have relied on logistic regression (LR), shown moderate accuracy, and used intraoperative variables. We sought to use an emerging approach in predictive analytics, machine learning, to create a model for UI. Methods Patients who underwent colorectal surgery were identified in the National Surgical Quality Improvement Program (NSQIP) database. Patients were split into training, validation, and test sets. The primary outcome was UI. Three machine learning approaches were tested including random forest (RF), gradient boosting (XGB), and neural networks (NN), and compared with traditional LR. Model performance was assessed using area under the curve (AUROC). Results The data set included 262,923 patients, of whom 1519 (.578%) experienced UI. Of the modeling techniques, XGB performed the best, with an AUROC score of .774 (95% CI .742-.807) compared with .698 (95% CI .664-.733) for LR. Random forest and NN performed similarly with scores of .738 and .763, respectively. Type of procedure, work RVUs, indication for surgery, and mechanical bowel prep showed the strongest influence on model predictions. Conclusions Machine learning-based models significantly outperformed LR and previous models and showed high accuracy in predicting UI during colorectal surgery. With proper validation, they could be used to support decision making regarding the placement of ureteral stents preoperatively