Anorexia nervosa (AN) is a devastating eating disorder characterized by self-starvation that mainly affects women. Its etiology is unknown, which impedes successful treatment options leading to a limited chance of full recovery. Here, we show that gestation is a vulnerable window that can influence the predisposition to AN. By screening placental microRNA expression of naive and prenatally stressed (PNS) fetuses and assessing vulnerability to activity-based anorexia (ABA), we identify miR-340 as a sexually dimorphic regulator involved in prenatal programming of ABA. PNS caused gene-body hypermethylation of placental miR-340, which is associated with reduced miR-340 expression and increased protein levels of several target transcripts, GR, Cry2 and H3F3b. MiR-340 is linked to the expression of several nutrient transporters both in mice and human placentas. Using placenta-specific lentiviral transgenes and embryo transfer, we demonstrate the key role miR-340 plays in the mechanism involved in early life programming of ABA.