The invention relates to the field of veterinary drugs, in particulrl to a composition for treating swine mycoplasmal pneumonia and porcine contagious pleuropneumonia and a preparation method thereof. The composition is prepared from, by weight, 15-20 parts of rhizoma atractylodis, 15-20 parts of radix saposhnikoviae, 10-13 parts of liquorice, 10-15 parts of apricot kernels, 30-35 parts of radix astragali, 15-20 parts of radix asteris, 10-15 parts of flos farfarae, 10-15 parts of herba ephedrae, 10-15 parts of periostracum cicada, 10-15 parts of fructus forsythiae and 20-30 parts of lonicera japonica. The composition has the effects of clearing heat, discharging fire, diminishing inflammation, resisting bacteria and the like, all the traditional Chinese medicines are proportioned reasonably to complement and coordinate mutually, the good treatment effect on the swine mycoplasmal pneumonia and the porcine contagious pleuropneumonia is achieved, the treatment course is short, the effects are rapid to achieve, and the cure rate is high; meanwhile, the preparation method of the composition is simple, safe, reliable, free of pollution and residues and easy to popularize.