The invention discloses a traditional Chinese medicine composition used for preventing and treating mycoplasmal pneumonia of swine. The traditional Chinese medicine composition comprises the following components in parts by weight as main active components: 20-30 parts of herba houttuyniae, 15-25 parts of membranous milkvetch roots, 15-25 parts of radix stemonae, 15-20 parts of platycodon grandiflorum, 15-20 parts of garlic, 10-20 parts of rhizoma anemarrhenae, 10-15 parts of ephedra, 10-15 parts of roots of redroot gromwell, and 5-10 parts of radix glycyrrhizae. The invention also discloses a preparation method and application of the traditional Chinese medicine composition. Tests show that the traditional Chinese medicine composition can inhibit in-vitro growth of mycoplasma hyopneumoniae, can well control the mycoplasma hyopneumoniae for infection and pathogenicity of mice, and is clinically used for preventing and treating infection and pathogenicity of the mycoplasma hyopneumoniae, has a good pharmaceutical effect and no toxic or side effects, and is convenient to take.