A bacteria that can create calories out of thin air sounds like it’d be useful, if true.
The belief in bacteria causing obesity is so prevalent in the medical world, that you can’t donate fecal matter for a fecal transplant if you’re above a certain body fat percentage, because it’s believed bacteria obese people carry that caused them to become obese will make a thin person obese if the bacteria is transplanted to the thin person from the obese person.

The bacteria don’t produce calories out of thin air, even high school physics will teach you that energy needs to be conserved!
I didn’t do biology, but from my understanding, energy (mostly) comes from the food you eat, and any excess is stored as fat. Obesity occurs when you have too much of that excess where it is a health risk, and differs depending on your metabolism and that sort (which things like gut bacteria can change because of weird biology shenanigans, don’t ask me, I’m a physicist).
But if there is no food, then you don’t intake any energy. Famine is defined as the widespread lack of food (by natural or artificial causes, unfortunately it’s often the latter), and when you don’t have food, you don’t tend to have high obesity rates.