BACKGROUND: Surgical-site infection is a source of significant morbidity after colorectal surgery. Previous efforts to develop models that predict surgical-site infection have had limited accuracy. Machine learning has shown promise in predicting postoperative outcomes by identifying nonlinear patterns within large data sets.OBJECTIVE: This study aimed to seek usage of machine learning to develop a more accurate predictive model for colorectal surgical-site infections.DESIGN: Patients who underwent colorectal surgery were identified in the American College of Surgeons National Quality Improvement Program database from years 2012 to 2019 and were split into training, validation, and test sets. Machine-learning techniques included random forest, gradient boosting, and artificial neural network. A logistic regression model was also created. Model performance was assessed using area under the receiver operating characteristic curve.SETTINGS: A national, multicenter data set.PATIENTS: Patients who underwent colorectal surgery.MAIN OUTCOME MEASURES: The primary outcome (surgical-site infection) included patients who experienced superficial, deep, or organ-space surgical-site infections.RESULTS: The data set included 275,152 patients after the application of exclusion criteria. Of all patients, 10.7% experienced a surgical-site infection. Artificial neural network showed the best performance with area under the receiver operating characteristic curve of 0.769 (95% CI, 0.762-0.777), compared with 0.766 (95% CI, 0.759-0.774) for gradient boosting, 0.764 (95% CI, 0.756-0.772) for random forest, and 0.677 (95% CI, 0.669-0.685) for logistic regression. For the artificial neural network model, the strongest predictors of surgical-site infection were organ-space surgical-site infection present at time of surgery, operative time, oral antibiotic bowel preparation, and surgical approach.LIMITATIONS: Local institutional validation was not performed.CONCLUSIONS: Machine-learning techniques predict colorectal surgical-site infections with higher accuracy than logistic regression. These techniques may be used to identify patients at increased risk and to target preventive interventions for surgical-site infection.