Background: The goal of this study was to categorize patients with abnormal serum phosphate upon hospital admission into distinct clusters utilizing an unsupervised machine learning approach, and to assess the mortality risk associated with these clusters. Methods: We utilized the consensus clustering approach on demographic information, comorbidities, principal diagnoses, and laboratory data of hypophosphatemia (serum phosphate ≤ 2.4 mg/dL) and hyperphosphatemia cohorts (serum phosphate ≥ 4.6 mg/dL). The standardized mean difference was applied to determine each cluster’s key features. We assessed the association of the clusters with mortality. Results: In the hypophosphatemia cohort (n = 3113), the consensus cluster analysis identified two clusters. The key features of patients in Cluster 2, compared with Cluster 1, included: older age; a higher comorbidity burden, particularly hypertension; diabetes mellitus; coronary artery disease; lower eGFR; and more acute kidney injury (AKI) at admission. Cluster 2 had a comparable hospital mortality (3.7% vs. 2.9%; p = 0.17), but a higher one-year mortality (26.8% vs. 14.0%; p < 0.001), and five-year mortality (20.2% vs. 44.3%; p < 0.001), compared to Cluster 1. In the hyperphosphatemia cohort (n = 7252), the analysis identified two clusters. The key features of patients in Cluster 2, compared with Cluster 1, included: older age; more primary admission for kidney disease; more history of hypertension; more end-stage kidney disease; more AKI at admission; and higher admission potassium, magnesium, and phosphate. Cluster 2 had a higher hospital (8.9% vs. 2.4%; p < 0.001) one-year mortality (32.9% vs. 14.8%; p < 0.001), and five-year mortality (24.5% vs. 51.1%; p < 0.001), compared with Cluster 1. Conclusion: Our cluster analysis classified clinically distinct phenotypes with different mortality risks among hospitalized patients with serum phosphate derangements. Age, comorbidities, and kidney function were the key features that differentiated the phenotypes.