To train and validate machine learning-derived clinical decision algorithm (MLCDA) for the diagnosis of hyperfunctioning parathyroid glands using preoperative variables to facilitate surgical planning. This retrospective study included 458 consecutive primary hyperparathyroidism (PHPT) patients who underwent combined 4D-CT and sestamibi SPECT/CT (MIBI) with subsequent parathyroidectomy from February 2013 to September 2016. The study cohort was divided into training (first 400 patients) and validation sets (remaining 58 patients). Sixteen clinical, laboratory, and imaging variables were evaluated. A random forest algorithm selected the best predictor variables and generated a clinical decision algorithm with the highest performance (MLCDA). The MLCDA was trained to predict the probability of a hyperfunctioning vs normal gland for each of the four parathyroid glands in a patient. The reference standard was a four-quadrant location on operative reports and pathology. The accuracy of MLCDA was prospectively validated. Of 16 variables, the algorithm selected 3 variables for optimal prediction: combined 4D-CT and MIBI using (1) sensitive reading, (2) specific reading, and (3) cross-product of serum calcium and parathyroid hormone levels and outputted an MLCDA using five probability categories for hyperfunctioning glands. The MLCDA demonstrated excellent accuracy for correct classification in the training (4D-CT + MIBI: 0.91 [95% CI: 0.89-0.92]) and validation sets (4D-CT + MIBI: 0.90 [95% CI: 0.86-0.94]. Machine learning generated a clinical decision algorithm that accurately diagnosed hyperfunctioning parathyroid glands through classification into probability categories, which can be implemented for improved preoperative planning and convey diagnostic certainty. Question Can an MLCDA use preoperative variables for the diagnosis of hyperfunctioning parathyroid glands to facilitate surgical planning? Findings The developed MLCDA demonstrated excellent accuracy for correct classification in the training (0.91 [95% CI: 0.89-0.92]) and validation sets (0.90 [95% CI: 0.86-0.94]). Clinical relevance Using standard preoperative variables, an MLCDA for diagnosing hyperfunctioning parathyroid glands can be implemented to improve preoperative parathyroid localization and included in radiology reports forsurgical planning.