Background Upper gastrointestinal (GI) bleeding is a common emergency department (ED) presentation with substantial morbidity and mortality. Endoscopy is the diagnostic and therapeutic cornerstone, yet pre-endoscopic risk-stratification tools such as the Glasgow–Blatchford Score (GBS) are highly sensitive but suffer from low specificity, leading to a high rate of negative endoscopies. We aimed to develop and internally validate supervised machine-learning (ML) models to predict endoscopically confirmed active bleeding (Forrest Ia/Ib) using routinely available admission data, with the goal of improving specificity and reducing unnecessary endoscopic procedures. Methods A retrospective, observational, cross-sectional, analytical study was conducted in the ED of a tertiary-care academic hospital after ethics committee approval. Patients aged ≥ 18 years who presented between 1 January 2015 and 1 August 2022 with a working diagnosis of upper GI bleeding and underwent endoscopy were screened. Demographics, vital signs, digital rectal examination findings, comorbidities, complete blood count, biochemistry, coagulation, venous blood gas parameters, GBS, and endoscopic Forrest classification were extracted. Active bleeding was defined as Forrest 1a or 1b. A priori power analysis indicated a target sample size of 1146; 1009 patients met inclusion criteria, of whom 666 (≈ 70%) were randomly allocated to the training set and 343 (≈ 30%) to the internal validation/test set using Python v3.9.0. Five ML algorithms — Gaussian Naive Bayes (GNB), K-Nearest Neighbors (KNN), Support Vector Machines (SVM), Random Forest, and Logistic Regression — were trained on admission features and evaluated on the held-out set. Performance was summarised by sensitivity, specificity, positive and negative likelihood ratios, positive and negative predictive values (PPV/NPV), and accuracy. Group comparisons in the test set were performed with Chi-square/Fisher’s exact, independent-samples t and Mann–Whitney U tests in SPSS v24.0 (two-sided p < 0.05). Results Of 343 patients in the test set, 30 (8.7%) had endoscopically confirmed active bleeding. Compared with the no-active-bleeding group, patients with active bleeding had significantly higher GBS (13.07 ± 1.93 vs. 12.19 ± 2.36; p = 0.039) and lower platelet counts (224.37 ± 95.58 vs. 267.65 ± 118.78 × 10³/µL; p = 0.049). Other admission parameters (age, sex, vital signs, hemoglobin, BUN, INR, pH, lactate) did not differ significantly. Forrest classification in the 153 patients with positive endoscopic findings was Forrest 3 in 58.2%, Forrest 1b in 17.0%, Forrest 1a in 2.6%, Forrest 2a in 8.5%, Forrest 2b in 8.5%, and Forrest 2c in 5.2%. Compared against the reference standard, the GNB, SVM, Random Forest, and Logistic Regression models showed a statistically significant association with active bleeding (p = 0.017, p < 0.001, p < 0.001, p < 0.001, respectively), whereas the KNN model did not (p = 0.241). Random Forest achieved the highest sensitivity (80.0%) and NPV (97.0%), Logistic Regression sensitivity 70.0% / NPV 95.86%, and SVM sensitivity 63.33% / NPV 95.14%. KNN had the highest specificity (99.36%) and accuracy (90.96%) but very low sensitivity (3.33%). Conclusions In ED patients undergoing endoscopy for suspected upper GI bleeding, ML models trained on routinely collected admission data — particularly Random Forest, Logistic Regression and SVM — achieved high negative predictive values (≥ 95%) for endoscopically confirmed active bleeding. Given the 8.7% prevalence of active bleeding in our cohort, these models may help safely identify patients who can defer urgent endoscopy and complement, rather than replace, existing risk scores such as the GBS. Prospective multicentre validation is required before clinical deployment.