The invention discloses a traditional Chinese medicine composition for preventing and treating piglet diarrhea. The composition is prepared from the following components in parts by weight: 6-24 parts of astragalus membranaceus, 6-24 parts of codonopsis pilosula, 6-18 parts of poria cocos, 6-15 parts of rhizoma atractylodis macrocephalae, 6-24 parts of saposhnicovia divaricata, 6-15 parts of semen lablab album, 6-15 parts of agastache rugosa, 9-15 parts of medicated leaven, 6-15 parts of hawthorn, 6-24 parts of coptis chinensis, 6-18 parts of lonicera japonica, 9-36 parts of fructus forsythiae, 6-18 parts of scutellaria baicalensis, 6-24 parts of folium isatidis, 6-15 parts of pericarpium citri reticulatae and 3-10 parts of oligopolyose. The traditional Chinese medicine composition contains multiple bioactive substances, such as polysaccharide, alkaloids, saponins, organic acid and the like, can be used for treating both symptoms and root causes of piglet diarrhea, can be used for improving body resistance, improving body immunity by tonifying middle jiao, tonifying qi, regulating qi circulation, promoting blood circulation, strengthening spleen, drying dampness, nourishing stomach and eliminating stagnation, can be used for regulating the micro-ecological environment of intestinal tracts and controlling piglet diarrhea, and has the effects of producing piglet growth and improving the rate of feed return.