Eh, we know how to make obesity and diabetes very rare. We have known for decades. Science already answered the question. We just don’t like the answer. We keep asking because we want an easier answer.
The way to prevent diabetes and obesity is: Exercise way more and eat a reasonable amount of a varied diet including lots of vegetables and fruits (and get lucky on your genetics).
“Exercise way more” is listed first because it is vastly more important than diet. “eat a reasonable amount” is next because you do need to avoid chronically taking in more calories than you use, however if you “exercise way more” it will be pretty easy to do. “a varied diet including lots of vegetables and fruits” is third because they give you good nutrients and mean that you can’t be eating nothing but steak and frosting, but really humans who “Exercise way more and eat a reasonable amount” can be quite healthy eating anything from mostly reindeer to mostly cornmeal. Finally in parenthesis is the one you can’t do anything about, well not entirely true, there are drugs nowadays for some people and via extraordinary willpower some will overcome even bad genetics.
The answer people want is “eat this one weird fruit and the pounds will melt away!”.