Cucurbita ficifolia is a squash grown from Mexico to Bolivia. Its ancestor is unknown, but it has limited compatibility with wild xerophytic Cucurbita from Mexico’s highlands. We assembled the reference genome of C. ficifolia and assessed the genetic diversity and historical demography of the crop in Mexico with 2524 nuclear single nucleotide polymorphisms (SNPs). We also evaluated the gene flow between C. ficifolia and xerophytic taxa with 6292 nuclear and 440 plastome SNPs from 142 individuals sampled in 58 sites across their area of sympatry. Demographic modelling of C. ficifolia supports an eight-fold decrease in effective population size at about 2409 generations ago (95% CI = 464–12,393), whereas plastome SNPs support the expansion of maternal lineages ca. 1906–3635 years ago. Our results suggest a recent spread of C. ficifolia in Mexico, with high genetic diversity (π = 0.225, FST = 0.074) and inbreeding (FIS = 0.233). Coalescent models suggest low rates of gene flow with C. radicans and C. pedatifolia, whereas ABBA-BABA tests did not detect significant gene flow with wild taxa. Despite the ecogeographic proximity of C. ficifolia and its relatives, this crop persists as a highly isolated lineage of puzzling origin.