This study examined the effect of a low-carbohydrate diet (LCD) and a low-carbohydrate ketogenic diet (LCKD) on diabetic retinopathy in high-fat diet-induced diabetes mellitus in rats and studied the mechanisms of action. Rats were divided into four groups: the Control group, which was fed a normal diet for 16 weeks; the HFD group, which was fed a high-fat diet (HFD) for the first 8 weeks and then switched to a normal diet for 8 weeks; the HFD+LCD group, fed a HFD for 8 weeks followed by an LCD for 8 weeks, and the HFD+LCKD group, which was fed a HFD for 8 weeks followed by an LCKD for 8 more weeks. Both the LCD and the LCKD effectively reduced the final body and total fat weights and decreased fasting serum levels of glucose, insulin, hemoglobin A1 (HbA1C), triglycerides, cholesterol, and LDL-c. They also reduced the levels of malondialdehyde (MDA), tumor necrosis factor-α, vascular endothelial factor, caspapse-3, and bax. In the HFD rats, we found increased serum levels of β-Hydroxybutyrate and upregulated expression of Bcl2, glutathione, superoxide dismutase, and hemeoxygenase-1. Moreover, the LCD and LCKD significantly reduced mRNA levels of Kelch-like ECH-associated protein 1 (Keap1) and enhanced mRNA and nuclear concentrations of nuclear factor erythroid factor 2 (Nrf2). All these effects were associated with improved layers of the retina in the HFD - LCD and HFD + LCKD rats but not in HFD animals. The impact of the LCKD was always more profound on all measured parameters and on improving the structure of the retina compared to the LCD. In conclusion, the LCKD is superior to the LCD in preventing diabetic retinopathy in HFD-fed rats. Mechanistically, our results suggest that the hypoglycemic and hypolipidemic conditions and the Nrf2-dependent antioxidant and anti-inflammatory effects may be involved in the preventative effects of the LCD and LCKD.