The growth and establishment of plant species are strongly influenced by environmental conditions and habitat ecological characteristics. This study investigated the relationships between environmental factors and the distribution of Ferula gummosa in the rangelands of the Taleghan watershed, Alborz Province, Iran. Vegetation sampling was conducted using 40 plots along four 100-m transects, accompanied by soil sampling. Vegetation communities were classified using the TWINSPAN method, and Principal Component Analysis (PCA) was applied to identify the main factors affecting species distribution. The results indicated that elevation, slope, organic matter, nitrogen content, lime content, and soil texture were the most influential variables. The Agropyron intermedium vegetation type provided the most favorable habitat conditions, characterized by an elevation of approximately 2400 m, a 35% slope, 2.8% organic matter, 0.25% nitrogen, and sandy loam soil. In contrast, the Sophora alopecuroides–Astragalus paralogues type exhibited the least suitable conditions. The highest production and establishment of F.gummosa occurred at elevations of 2300–2500 m, slopes of 20–40%, and fertile sandy loam soils with high organic matter and nitrogen and lower lime content. These findings provide valuable information for habitat identification, ecological management, and sustainable conservation of this medicinal species