The invention provides a pharmaceutical composition for treating diabetes and a preparation method thereof, and relates to the technical field of medicines. The pharmaceutical composition for treating the diabetes comprises cereal dietary fibers, whey protein, milk powder, acerola cherries, Chinese wolfberry fruits, silybum marianum, a white kidney bean extract, chia seeds, psyllium seed husks, cordyceps militaris, cordyceps sinensis, oyster peptides, anoectochilus formosanus, lecithin, dendrobium officinale, selenium-enriched yeast powder, natto powder, vitamins, a sweetening agent, prebiotics and a calcium agent. Through mutual matching of specific components, the pharmaceutical composition can effectively control blood sugar and restore immunity. Moreover, all the components are medicinal and edible raw materials, so that the effects of purifying blood and reducing blood sugar can be achieved for patients through dietetic invigoration, and the pharmaceutical composition is green, safe and free of toxic and side effects, so that injury caused by abuse of medicines is effectively avoided.