Stachys inflata Benth. is a perennial shrub plant, with powerful natural antioxidant agents, which is recognized as a famous medicinal plant that is widely applied to treat Infection, Asthma, and Rheumatism. Iran is renowned as a center of diversity for Stachys, however, the ideal habitats of S. inflata in this nation remain unknown. The potential and future distribution of suitable habitats for S. inflata were projected using an ensembles ecological niche model in Isfahan province, Iran. We used occurrence data (using GPS), bioclimatic and topographic variables from the Chelsa and WorldClim databases to model the current and future potential distribution of this valuable species. The results showed that: (i) S. inflata is mainly distributed in the south, southwest, center, and west of the Isfahan province, and the excellent habitats of S. inflata accounted for 14.34% of the 107,000 km2 study area; (ii) mean annual temperature, mean daily temperature of wettest quarter, annual precipitation, and elevation were the four most important variables that affect the distribution of S. inflata, with a cumulative contribution of 56.55%; and (iii) about the half (− 42.36%) of the currently excellent habitats of S. inflata show a tendency to decrease from now to the 2080s, while often the area of other S. inflata habitats increases (the area of unsuitable habitat: 5.83%, the area of low habitat suitability: 24.68%, the area of moderate habitat suitability: 2.66%, and the area of high habitat suitability: 2.88%). The increase in the area of other S. inflata habitats is different and they are less favorable than the excellent habitat. The results help establishing a framework for long-term in-situ and ex-situ conservation and management practices in habitats of S. inflata in rangeland and agricultural ecosystems.