Abstract Background and Aims New-onset diabetes after transplantation (NODAT) is a common and serious complication of kidney transplantation that contributes to long-term morbidity and mortality after the transplant procedure. Conventional methods may predict the risk of, but not time to developing NODAT. We aimed to develop a machine learning model that predicts the time to NODAT in kidney transplant recipients (KTR). Method Two large prospective cohort studies of stable KTR (inclusion >1 year after transplantation) from the University Medical Center Groningen were combined. Data collection took place between 2001 and 2003 for cohort A, and between 2008 and 2011 for cohort B, resulting in the inclusion of 750 KTR free of NODAT at baseline. To predict absolute time to NODAT, a bootstrap aggregating (bagging) approach was utilized which consisted of several extreme gradient boosting (XGBoost) models with the accelerated failure time (AFT) objective. The performance of the resulting bagging model was internally evaluated by assessing the concordance index (c-index) in 20% of the dataset not used for training. Results From the 750 KTR included, 76 (10.1%) developed NODAT during a median (interquartile range [IQR]) follow-up of 5.8 (4.7 to 9.2) years. The median (IQR) age was 51.2 (40.5 to 60.7) years and 342 (45.6%) of the KTR were female. During feature engineering, 18 features from 53 were selected. After hyperparameter tuning, model performance during internal validation was 0.84. Furthermore, SHapley Additive exPlanations (SHAP) values were used to estimate feature importance, which revealed that glucose, HbA1c, mean arterial pressure, cyclosporine concentrations and daily vegetable intake were the most important features. Conclusion The developed machine learning model shows good discriminative ability of time to NODAT prediction. Due to the methodology used, the model allows for flexible incremental learning, meaning that the bagging model can be retrained with additional data without compromising on performance.