This study aims to assess systemic risk factors in diabetes mellitus (DM) patients and predict diabetic retinopathy (DR) using a Random Forest (RF) classification model. We included DM patients presenting to the retina clinic for first-time DR screening. Data on age, gender, diabetes type, treatment history, DM control status, family history, pregnancy history, and systemic comorbidities were collected. DR and sight-threatening DR (STDR) were diagnosed via a dilated fundus examination. The dataset was split 80:20 into training and testing sets. The RF model was trained to detect DR and STDR separately, and its performance was evaluated using misclassification rates, sensitivity, and specificity. Data from 1416 DM patients were analyzed. The RF model was trained on 1132 (80%) patients. The misclassification rates were 0% for DR and ~20% for STDR in the training set. External testing on 284 (20%) patients showed 100% accuracy, sensitivity, and specificity for DR detection. For STDR, the model achieved 76% (95% CI-70.7%-80.7%) accuracy, 53% (95% CI-39.2%-66.6%) sensitivity, and 80% (95% CI-74.6%-84.7%) specificity. The RF model effectively predicts DR in DM patients using systemic risk factors, potentially reducing unnecessary referrals for DR screening. However, further validation with diverse datasets is necessary to establish its reliability for clinical use.