Despite having essential roles in maintaining human body physiology, magnesium has gained little attention. We sought to evaluate the prevalence and predictors of magnesium imbalance in diarrheal children admitted to an intensive care unit. This retrospective data analysis was conducted among children admitted between January 2019 and December 2019. Eligible children were categorized by serum magnesium levels that were extracted from the hospital database. Among 557 participants, 29 (5.2%) had hypomagnesemia, 344 (61.8%) had normomagnesemia and 184 (33.0%) had hypermagnesemia. By multivariable multinomial logistic regression, we have identified older children (adjusted multinomial odds ratio, mOR 1.01, 95% CI: 1.004–1.018, p = 0.002) as a predictor of hypomagnesemia. Conversely, younger children (adjusted mOR 0.99, 95% CI: 0.982–0.998, p = 0.02), shorter duration of fever (adjusted mOR 0.92, 95% CI: 0.857–0.996, p = 0.04), convulsion (adjusted mOR 1.55, 95% CI: 1.005–2.380, p = 0.047), dehydration (adjusted mOR 3.27, 95% CI: 2.100–5.087, p<0.001), pneumonia (adjusted mOR 2.65, 95% CI: 1.660–4.240, p<0.001) and acute kidney injury (adjusted mOR 2.70, 95% CI: 1.735–4.200, p<0.001) as the independent predictors of hypermagnesemia. The mortality was higher among children with hypermagnesemia (adjusted mOR 2.31, 95% CI: 1.26–4.25, p = 0.007). Prompt identification and management of the magnesium imbalance among critically ill diarrheal children might have survival benefits, especially in resource-limited settings.