ABSTRACT Objectives The search for drugs that can protect the brain tissue and reduce nerve damage in acute ischemic stroke has emerged as a research hotspot. We investigated the potential protective effects and mechanisms of action of dihydroergotamine against ischemic stroke. Methods C57BL/6 mice were subjected to middle cerebral artery occlusion (MCAO), and dihydroergotamine at a dose of 10 mg/kg/day was intraperitoneally injected for 14 days. Adhesive removal and beam walking tests were conducted 1, 3, 5, 7, 10, and 14 days after MCAO surgery. Thereafter, the mechanism by which dihydroergotamine regulates microglia/macrophage polarization and inflammation and imparts ischemic stroke protection was studied using enzyme-linked immunosorbent assay, immunofluorescence staining, and western blotting. Results From the perspective of a drug repurposing strategy, dihydroergotamine was found to inhibit oxygen-glucose deprivation damage to neurons, significantly improve cell survival rate, and likely exert a protective effect on ischemic brain injury. Dihydroergotamine significantly improved neural function scores and survival rates and reduced brain injury severity in mice. Furthermore, dihydroergotamine manifests its protective effect on ischemic brain injury by reducing the expression of TNF-α and IL-1β in mouse ischemic brain tissue, inhibiting the polarization of microglia/macrophage toward the M1 phenotype and promoting polarization toward the M2 phenotype. Conclusion This study is the first to demonstrate the protective effect of dihydroergotamine, a first-line treatment for migraine, against ischemic nerve injury in vitro and in vivo.