Experts said the findings were "potentially very exciting" as they could become a new treatment for the disease
The pancreas can be triggered into regenerating itself through stem-cell therapies, according to new research from the US.
Restoring the function of the organ - which helps control blood sugar levels - reversed symptoms of diabetes in animal experiments.
The study, published in the journal Cell, says the diet reboots the body.
Experts said the findings were "potentially very exciting" as they could become a new treatment for the disease.
People are advised not to try this without medical advice.
In the experiments, mice were put on a modified form of the "fasting-mimicking diet".
Dr Valter Longo, from the University of Southern California, said: "Our conclusion is that by pushing the mice into an extreme state and then bringing them back - by starving them and then feeding them again - the cells in the pancreas are triggered to use some kind of developmental reprogramming that rebuilds the part of the organ that's no longer functioning."
There were benefits in both type 1 and type 2 diabetes in the mouse experiments.
Type 1 is caused by the immune system destroying beta cells and type 2 is largely caused by lifestyle and the body no longer responding to insulin.
Further tests on tissue samples from people with type 1 diabetes produced similar effects.
Dr Longo said: "Medically, these findings have the potential to be very important because we've shown - at least in mouse models - that you can use diet to reverse the symptoms of diabetes.
"Scientifically, the findings are perhaps even more important because we've shown that you can use diet to reprogram cells without having to make any genetic alterations."