Correlates between genetic diversity at intra- and interpopulation levels and the species diversity in plant communities are rarely investigated. Such correlates may give insights into the effect of local selective forces across different communities on the genetic diversity of local plant populations. This study has employed amplified fragment length polymorphism to assess the genetic diversity within and between 10 populations of Ranunculus acris in relation to the species diversity (richness and evenness) of grassland communities of two different habitat types, ‘seminatural’ and ‘agriculturally improved’, located in central Germany. Within-population genetic diversity estimated by Nei's unbiased gene diversity (HE) was high (0.258–0.334), and was not correlated with species richness (Pearson's r = −0.17; P = 0.64) or species evenness (Pearson's r = 0.15; P = 0.68) of the plant communities. However, the genetic differentiation between R. acris populations was significantly correlated with the difference in species evenness (Mantel's r = 0.62, P = 0.02), but not with difference in species richness of plant communities (r = −0.17, P = 0.22). Moreover, we also found that populations of R. acris from the ‘seminatural’ habitat were genetically different (amova, P < 0.05) from those in ‘agriculturally improved’ habitats, suggesting that gene flow between these habitat types is limited. The results reported in this study may indicate that habitat characteristics influence the genetic diversity of plant species.