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".
It is like the human form of the diet when people spend five days on a low-calorie, low-protein, low-carbohydrate but high unsaturated-fat diet.
It resembles a vegan diet with nuts and soups, but with around 800 to 1,100 calories a day.
Then they have 25 days eating what they want - so overall it mimics periods of feast and famine.
Previous research has suggested it can slow the pace of ageing.
But animal experiments showed the diet regenerated a special type of cell in the pancreas called a beta cell.
These are the cells that detect sugar in the blood and release the hormone insulin if it gets too high.
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 reprogramme cells without having to make any genetic alterations."