Posthepatectomy liver failure (PHLF) is a serious complication associated with high mortality rates. Machine learning (ML) has rapidly developed and may outperform traditional models in predicting PHLF in patients who have undergone hepatectomy. This study aimed to predict PHLF using ML and compare its performance with that of traditional scoring systems. The clinicopathological data of 334 patients who underwent liver resection were retrospectively collected. The Pycaret library, a simple, open-source machine learning library, was used to compare multiple classification models for PHLF prediction. The predictive performance of 15 ML algorithms was compared using the mean area under the receiver operating characteristic curve (AUROC) and accuracy, and the best-fit model was selected among 15 ML algorithms. Next, the predictive performance of the selected ML-PHLF model was compared with that of routine scoring systems, the albumin-bilirubin score (ALBI) and the fibrosis-4 (FIB-4) index, using AUROC. The best model was extreme gradient boosting (accuracy:93.1%; AUROC:0.863) among the 15 ML algorithms. As compared with ALBI and FIB-4, the ML PHLF model had higher AUROC for predicting PHLF. The novel ML model for predicting PHLF outperformed routine scoring systems.