Gastric bypass surgery is the most effective treatment and is often the only option for subjects with severe obesity. However, investigation of critical molecular mechanisms involved has been hindered by confounding of specific effects of surgery and side effects associated with acute surgical trauma. Here, we dissociate the two components by carrying out surgery in the lean state and testing its effectiveness to prevent diet-induced obesity later in life. Body weight and composition of female mice with RYGB performed at 6 weeks of age were not significantly different from sham-operated and age-matched non-surgical mice at the time of high-fat diet exposure 12 weeks after surgery. These female mice were completely protected from high-fat diet-induced obesity and accompanying metabolic impairments for up to 50 weeks. Similar effects were seen in male mice subjected to RYGB at 5-6 weeks, although growth was slightly inhibited and protection from diet-induced obesity was less complete. The findings confirm that RYGB does not indiscriminately lower body weight but specifically prevents excessive diet-induced obesity and ensuing metabolic impairments. This prevention of obesity model should be crucial for identifying the molecular mechanisms underlying gastric bypass surgery.