Abstract Background and Aims New onset diabetes after transplantation (NODAT) or PTDM (Post-transplant Diabetes Mellitus) is associated with increased morbidity, renal graft loss, cardiovascular complications, mortality and increased health care costs. It has been shown that incidence of NODAT is rising in recent years. It is suggested that there is more prominent role of beta cell dysfunction rather than insulin resistance in patients with PTDM. Hypomagnesemia which is commonly seen in post-transplant patients is suggested to have a role in promoting beta cell dysfunction. Emerging modifiable risk factors for PTDM like hypomagnesemia need to be studied which may help to improve its prevalence and outcomes. Method This study was single centre study to assess association of PTDM or NODAT with hypomagnesemia. Other risk factors like body mass index (BMI) >25 kg/m2, higher age and sex of the recipient were also studied. This study was a prospective, non-randomised, comparative, observational study. Duration of the study was from 1st October 2016 to 28th February 2018. Recipients with age > 18 years with at least 2 fasting blood sugar readings of >126 mg/dl or 2 post prandial readings of >200 mg/dl or need for antidiabetic medications beyond 1-month post-transplant were studied as PTDM or NODAT. Patients with deceased donor transplant, second kidney transplant, simultaneous other organ transplant, active Hepatitis C infection, active cytomegalovirus infection, patients with acute rejection, patients with polycystic kidney disease and patients with basiliximab induction were excluded. Results After applying exclusion and exclusion criteria, 98 patients were studied in total. Among 98 patients around 40 patients developed PTDM. When assessed independently higher age of the patient (age more than 50 years) was associated with PTDM (p = .030) while sex of the recipient was not associated with PTDM (P = .188). BMI >25 kg/m2 was significantly associated with PTDM at 1 month (p = .0001), 2 month (p < .0001), 3 month (p < .0001), 6 month (p < .0001), 9 month (p = .0001) and 12 month (p = .003) post-transplant. No statistical difference between doses of steroids were seen in patients with or without PTDM. All 98 patients received tacrolimus as part of their immunosuppressant regime. Time varying serum tacrolimus trough levels were not associated with PTDM and was removed as confounder by using univariate cox proportional hazard model (p = 0.691). After univariate and subsequently multivariate logistic regression analysis only hypomagnesemia was significantly associated with PTDM (p = .0001). After using univariate and subsequently multivariate cox proportional hazard model to study time varying risk factors, both hypomagnesemia (HR, 0.099; 95% CI, 0.016-0.624, p = .014) and BMI >25 kg/m2 (HR, 3.435; 95% CI, 1.657-7.119, p = .001) were associated with PTDM. Significantly a greater number of patients with lower magnesium levels developed PTDM early as compared to patients with normal magnesium levels (Spearman's coefficient of rank correlation (rho) = 0.53; 95% CI, 0.261-0.722, p = .0004). Conclusion Hypomagnesemia and overweight are modifiable risk factors significantly associated with PTDM even after removing confounding factors. Early development of PTDM in patient with hypomagnesemia further corroborates its role. Active interventions should be sought to control hypomagnesemia and overweight which may improve the morbidity and mortality of kidney transplant patients in long run.