Patients under the age of 70 who are admitted to hospital for obesity carry a higher risk of developing the condition than those who were not recorded to be obese, experts found.
They found the risk was highest among those with a record of obesity when they are in their 30s.
Estimates suggest there are currently 800,000 people with dementia in the UK, a figure which is expected to soar to over one million by 2021.
Meanwhile, data from the Health and Social Care Information Centre show that in England during 2012 almost one in five people aged 25 to 34 and around a quarter of those aged 25 to 44 were obese.
About 30% of the those aged 45 to 74 are obese.
The new study concluded that age could be a key factor after finding that the level of risk reduced with increasing age at the first record of obesity.
The researchers, from the University of Oxford, examined data from hospital records for the whole of England between 1999 and 2011. When a case of obesity had been recorded the researchers then did searches for care for or death from dementia.
Their study, published in the Postgraduate Medical Journal, examined the anonymised data from 451,232 people with obesity and a control group. They found that for those aged 30 to 39, the relative risk of developing dementia was 3.5 times higher than in those of the same age who were not obese.
They found a 70% heightened risk for people in their 40s, which fell to a 50% increased risk for those in their 50s. And for those aged 60 to 69 there was a 40% increased risk.
The researchers observed no additional risk of dementia in people admitted to hospital for obesity in their 70s and those in their 80s were 22% less likely to develop the disease.
"The risk of dementia in people who are obese in early to mid-adult life seems to be increased," the authors wrote.
"The level of risk depends on the age at which they are recorded as being obese (which may be an age or a birth cohort effect) and, while obesity at a younger age is associated with an increased risk of future dementia, obesity in people who have lived to about 60 to 80 years of age seems to be associated with a reduced risk."
Commenting on the study, Dr Clare Walton, research communications manager at the Alzheimer's Society charity, said: "These results support existing evidence that obesity in mid-life increases the risk of developing dementia.
"The finding that people who are obese in their 30s are three times more likely to get dementia is striking, but it is difficult to draw firm conclusions from a study where only 19 of the 451,232 people observed were obese in their 30s and went on to develop dementia.
"Given the growing body of evidence that being overweight in mid-life rather than in later years seems to be the bigger risk factor for dementia, it is never too early to start making healthy lifestyle choices.
"We know what is good for your heart is good for your head and that the best way of reducing your risk of developing dementia is to eat a balanced diet, maintain a healthy weight, exercise regularly and get your blood pressure and cholesterol checked."
Dr Eric Karran, director of research at charity Alzheimer's Research UK, added: "This large-scale study builds on previous evidence that obesity influences dementia risk. What is interesting about this research is that it suggests that obesity in earlier life can influence health in later life.
"There are a number of limitations to the work that are highlighted by the authors. One limitation of the study is that the data for obesity came from hospital admissions so it is hard to gauge the risk in people who were obese but did not need to be hospitalised.
"Obesity itself is associated with other risk factors, such as diabetes and high blood pressure, which could also influence dementia risk. The follow-up period of 14 years is not sufficiently long, especially for those younger members of the cohort.
"More research is needed to establish exactly why obesity can affect dementia risk. There is an increasing body of evidence that lifestyle factors are linked to dementia risk.
"As well as maintaining a healthy weight, research suggests that keeping blood pressure in check, not smoking and regular exercise throughout life are good ways to keep the brain healthy. Anyone who is concerned about their weight or general health should see their GP."