Porcine deltacoronavirus (PDCoV) is a newly discovered swine enteropathogenic coronavirus with worldwide distribution. However, efficient strategies to prevent or treat the infection remain elusive. Our in vitro study revealed that ergosterol peroxide (EP) from the mushroom Cryptoporus volvatus has efficient anti-PDCoV properties. The aim of this study is to evaluate the potential of EP as a treatment for PDCoV in vivo and elucidate the possible mechanisms. Seven-day-old piglets were infected with PDCoV by oral administration in the presence or absence of EP. Piglets infected with PDCoV were most affected, whereas administration of EP reduced diarrhea incidence, alleviated intestinal lesion, and decreased viral load in feces and tissues. EP reduced PDCoV-induced apoptosis and enhanced tight junction protein expressions in the small intestine, maintaining the integrity of the intestinal barrier. EP showed immunomodulatory effect by suppressing PDCoV-induced pro-inflammatory cytokines and the activation of IκBα and NF-κB p65, and upregulating IFN-I expression. Knockdown of p38 inhibited PDCoV replication and alleviated PDCoV-induced apoptosis, implying that EP inhibited PDCoV replication and alleviated PDCoV-induced apoptosis via p38/MAPK signaling pathway. Collectively, ergosterol peroxide can protect piglets from PDCoV, revealing the potential of EP for development as a promising strategy for treating and controlling the infection of PDCoV.