The invention relates to a medicine in which a Uigur medicine, namely gallnut is taken as a raw medicine and which is used for treating oral diseases, and a preparation method thereof. The medicine is prepared by the following steps of: obtaining a crude gallnut extract by a solvent extraction method, further obtaining effective parts and effective components of the gallnut by a macroporous resinmethod or a gel chromatography method or an ultrafiltration membrane method, and adding pharmaceutically acceptable excipients to obtain buccal tablets, orally disintegrating tablets, oral effervescent tablets, and a film agent. In the medicine, the effective parts and the effective components, which are used for treating oral diseases, of the gallnut are enriched by modern separation and purification technologies, so that the utilization rate of functional compositions is improved, the law of absorption, distribution and metabolism of medicines in human bodies is met, and the medicinal effect is improved. Through pharmacological experiments, the effective parts and the effective components of the gallnut have the effects of resisting inflammation, easing pain, resisting bacteria and oxidation, immunoregulating and the like, can quickly repair dental ulcer and accelerate the healing of dental ulcer, and can effectively resist oral diseases such as gingivitis, ozostomia, stinking throat, mouth and tongue sore and the like caused by common pathogenic bacteria in oral cavities.