There are few predictive studies about early posttransplant outcomes taking into account baseline and posttransplant variables. The objective of this study was to create a predictive model for 30-day graft rejection using machine learning techniques. Retrospective study with 1255 patients undergoing transplant from living and deceased donors at a tertiary health service in Brazil. Recipient, donor, transplantation, and postoperative period data were collected from physical and electronic records. We split the data into derivation (training) and validation (test) datasets. Five supervised machine learning algorithms were developed with this subset of variables in the training set: Simple Logistic Regression, Lasso, Multilayer Perceptron, XGBoost, and Light GBM. There were 147 (12.48%) cases of graft rejection within 30 days of transplantation. The best model was XGBoost (accuracy, 0.839; receiver operating characteristic area under the curve, 0.715; precision, 0.900). The model showed that deceased donor transplantation, glomerulopathy as an underlying disease, and donor's use of vasoactive drugs had more than 20% importance as rejection risk factors. The variables with the greatest predictive values were thymoglobulin induction and delayed graft function. We fitted a machine learning model to predict 30-day graft rejection after kidney transplantation that reaches a higher accuracy and precision. Machine learning models could contribute to predicting kidney survival using nontraditional approaches.