Abstract Background Cucurbita ficifolia is one of the squash species most resistant to fungal pathogens, and has especially high resistance to melon Fusarium wilt. This species is therefore an important germplasm resource for the breeding of squash and melon cultivars. Results Whole-genome resequencing of 223 individuals from 32 populations in Yunnan Province, the main cucurbit production area in China, was performed and 3,855,120 single-nucleotide polymorphisms (SNPs) and 1,361,000 InDels were obtained. SNP analysis suggested that levels of genetic diversity in C. ficifolia were high, but that different populations showed no significant genetic differentiation or geographical structure, and that individual C. ficifolia plants with fruit rinds of a similar color did not form independent clusters. A Mantel test conducted in combination with geographical distance and environmental factors suggested that genetic distance was not correlated with geographical distance, but had a significant correlation with environmental distance. Further associations between the genetic data and five environmental factors were analyzed using whole-genome association analysis. SNPs associated with each environmental factor were investigated and genes 250 kb upstream and downstream from associated SNPs were annotated. Overall, 15 marker-trait-associated SNPs (MTAs) and 293 genes under environmental selection were identified. The identified genes were involved in cell membrane lipid metabolism, macromolecular complexes, catalytic activity and other related aspects. Ecological niche modeling was used to simulate the distribution of C. ficifolia across time, from the present and into the future. We found that the area suitable for C. ficifolia changed with the changing climate in different periods. Conclusions Resequencing of the C. ficifolia accessions has allowed identification of genetic markers, such as SNPs and InDels. The SNPs identified in this study suggest that environmental factors mediated the formation of the population structure of C. ficifolia in China. These SNPs and Indels might also contribute to the variation in important pathways of genes for important agronomic traits such as yield, disease resistance and stress tolerance. Moreover, the genome resequencing data and the genetic markers identified from 223 accessions provide insight into the genetic variation of the C. ficifolia germplasm and will facilitate a broad range of genetic studies.