Diabetes mellitus type 1 and 2 is associated with cognitive impairment. Previous studies have reported a relationship between changes in cerebral metabolite levels and the variability of glycemia. However, the specific risk factors that affect the metabolic changes associated with type 1 and type 2 diabetes in cognitive dysfunction remain uncertain. The aim of the study was to evaluate the specificity of hippocampal spectroscopy in type 1 and type 2 diabetes and cognitive dysfunction. Materials and methods: 65 patients with type 1 diabetes with cognitive deficits and 20 patients without, 75 patients with type 2 diabetes with cognitive deficits and 20 patients without have participated in the study. The general clinical analysis and evaluation of risk factors of cognitive impairment were carried out. Neuropsychological testing included the Montreal Scale of Cognitive Dysfunction Assessment (MoCA test). Magnetic resonance spectroscopy (MRS) was performed in the hippocampal area, with the assessment of N-acetylaspartate (NAA), choline (Cho), creatine (Cr), and phosphocreatine (PCr) levels. Statistical processing was performed using the commercially available IBM SPSS software. Results: Changes in the content of NAA, choline Cho, phosphocreatine Cr2 and their ratios were observed in type 1 diabetes. More pronounced changes in hippocampal metabolism were observed in type 2 diabetes for all of the studied metabolites. Primary risk factors of neurometabolic changes in patients with type 1 diabetes were episodes of severe hypoglycemia in the history of the disease, diabetic ketoacidosis (DKA), chronic hyperglycemia, and increased body mass index (BMI). In type 2 diabetes, arterial hypertension (AH), BMI, and patient’s age are of greater importance, while the level of glycated hemoglobin (HbA1c), duration of the disease, level of education and insulin therapy are of lesser importance. Conclusion: Patients with diabetes have altered hippocampal metabolism, which may serve as an early predictive marker. The main modifiable factors have been identified, correction of which may slow down the progression of cognitive dysfunction.