A precise forecast of the need for blood transfusions (BT) in patients undergoing total hip arthroplasty (THA) is a crucial step toward the implementation of precision medicine. To achieve this goal, we utilized supervised machine learning (SML) techniques to establish a predictive model for BT requirements in THA patients. Additionally, we employed unsupervised machine learning (UML) approaches to identify clinical heterogeneity among these patients. In this study, we recruited 224 patients undergoing THA. To identify factors predictive of BT during the perioperative period of THA, we employed LASSO regression and the random forest (RF) algorithm as part of supervised machine learning (SML). Using logistic regression, we developed a predictive model for BT in THA patients. Furthermore, we utilized unsupervised machine learning (UML) techniques to cluster THA patients who required BT based on similar clinical features. The resulting clusters were subsequently visualized and validated. We constructed a predictive model for THA patients who required BT based on six predictive factors: Age, Body Mass Index (BMI), Hemoglobin (HGB), Platelet (PLT), Bleeding Volume, and Urine Volume. Before surgery, 1 h after surgery, 1 day after surgery, and 1 week after surgery, significant differences were observed in HGB and PLT levels between patients who received BT and those who did not. The predictive model achieved an AUC of 0.899. Employing UML, we identified two distinct clusters with significantly heterogeneous clinical characteristics. Age, BMI, PLT, HGB, bleeding volume, and urine volume were found to be independent predictors of BT requirement in THA patients. The predictive model incorporating these six predictors demonstrated excellent predictive performance. Furthermore, employing UML enabled us to classify a heterogeneous cohort of THA patients who received BT in a meaningful and interpretable manner.