AimsTo explore the association between dietary knowledge, attitude, and practices during Ramadan among Muslim patients with type 2 diabetes. MethodsRecruited after Ramadan from public clinics and a hospital in Banda Aceh, Indonesia, 401 outpatients recalled their food consumption frequencies of high-fiber food, deep-fried food, and high-sugar dessert, and relevant knowledge and attitudes. Multivariable logistic regression models were applied to examine the research questions. ResultsVegetable consumption and preference were both high among the patients. However, only 4.5% knew that brown rice is rich in fiber, and 19% agreed that whole-grain foods were accessible. Deep-fried food consumption and its availability at home was common, even though the majority considered it should be avoided. Patients with a lower preference for deep-fried foods were less likely to consume deep-fried foods during Ramadan (OR = 0.239, 95% CI = 0.109–0.523, p = 0.001). Knowledge of the glycemic index’s health implication was associated with more high-fiber foods consumption (OR = 2.733, 95% CI = 1.179–6.332, p = 0.019). Yet, knowing the potential risk of added sugar on blood glucose level was associated with high-sugar dessert consumption (OR = 2.997, 95% CI = 1.482–6.060, p = 0.002). ConclusionThe patients’ low consumption of whole-grain food and common comsumption of deep-fried food during Ramadan would be the first priority to be improved. Along with dietary knowledge and attitude, food environment could be an important factor that influences patients’ dietary behaviors.