Background. The advent of value-based conscientiousness and rapid-recovery discharge pathways presents surgeons, hospitals, and payers with the challenge of providing the same total hip arthroplasty episode of care in the safest and most economic fashion for the same fee, despite patient differences. Various predictive analytic techniques have been applied to medical risk models, such as sepsis risk scores, but none have been applied or validated to the elective primary total hip arthroplasty (THA) setting for key payment-based metrics. The objective of this study was to develop and validate a predictive machine learning model using preoperative patient demographics for length of stay (LOS) after primary THA as the first step in identifying a patient-specific payment model (PSPM). Methods. Using 229,945 patients undergoing primary THA for osteoarthritis from an administrative database between 2009– 16, we created a naïve Bayesian model to forecast LOS after primary THA using a 3:2 split in which 60% of the available patient data “built” the algorithm and the remaining 40% of patients were used for “testing.” This process was iterated five times for algorithm refinement, and model performance was determined using the area under the receiver operating characteristic curve (AUC), percent accuracy, and positive predictive value. LOS was either grouped as 1–5 days or greater than 5 days. Results. The machine learning model algorithm required age, race, gender, and two comorbidity scores (“risk of illness” and “risk of morbidity”) to demonstrate excellent validity, reliability, and responsiveness with an AUC of 0.87 after five iterations. Hospital stays of greater than 5 days for THA were most associated with increased risk of illness and risk of comorbidity scores during admission compared to 1–5 days of stay. Conclusions. Our machine learning model derived from administrative