The relationship between type 2 diabetes mellitus (T2DM) and oral microbiota is still insufficiently recognized. In the present study, we compared the salivary microbiome of nondiabetic individuals, treatment-naïve diabetic patients, and diabetic patients treated with metformin or a combination of insulin and other drugs. The α- and β-diversity demonstrated significant differences in the salivary microbiome between the nondiabetic people and patients with a history of diabetes, while little divergence was found among individuals with a history of diabetes. After characterizing the effects of periodontitis on the microbial composition of each group, the salivary microbiome of the treatment-naïve diabetic patient group was compared with that of nondiabetic people and the metformin/combined treatment groups. The results revealed changes in the contents of certain bacteria after both the onset and the treatment of diabetes; among these differential bacteria, Blautia_wexlerae, Lactobacillus_fermentum, Nocardia_coeliaca and Selenomonas_artemidis varied in all processes. A subsequent correlational analysis of the differential bacteria and clinical characteristics demonstrated that salivary microbes were related to drug treatment and certain pathological changes. Finally, the four common differential bacteria were employed for distinguishing the treatment-naïve diabetic patients from the nondiabetic people and the treated patients, with prediction accuracies of 83.3%, 75% and 75%, respectively.