Student loyalty is a crucial factor supporting the sustainability of higher education institutions. The aim of this study is to predict student loyalty using a machine learning approach, specifically the random forest algorithm. The data for this research were collected through a questionnaire that included variables such as service quality, emotional attachment, brand satisfaction, brand trust, and socio-economic conditions, distributed to 107 students in Palembang. The resulting dataset was processed through preprocessing, model training, and performance evaluation, employing metrics such as accuracy, precision, recall, and F1-score. The analysis using the random forest algorithm achieved an accuracy of 90.9%. These findings are expected to provide valuable insights for higher education institutions in developing more effective strategies to enhance student loyalty.