The study developed and validated a machine learning model to predict preoperative deep vein thrombosis (DVT) in elderly hip fracture patients. She retrospectively analyzed 782 patients hospitalized at a university hospital from July 2022 to May 2025, of which 186 (23.8%) had DVT. The data was split into a training set (70%) and a validation set (30%), testing DT, XGBoost, SVM, LightGBM and LR algorithms. They selected five key features: time from injury to admission, levels of D-dimer, hemoglobin, albumin, and activated partial thromboplastin time (APTT). The XGBoost model was the best with an AUC of 0.829 (95% CI: 0.788–0.870) on the training set and 0.808 (95% CI: 0.742–0.874) on the validation set. The calibration curve confirmed the agreement of the predictions with the observed results, and the decision curve showed the clinical benefits. A model with SHAP analysis and a web tool improves preoperative assessment and clinical decision making.