The researchers from Oxford University, working with a team from Sri Lanka and the University of Bradford, analysed the carbon and oxygen isotopes in the teeth of 26 individuals, with the oldest dating back 20,000 years.
They found that nearly all the teeth analysed suggested a diet largely sourced from the rainforest.
The study, published in the the journal Science shows that early modern humans adapted to living in the rainforest for long periods of time.
Scholars reasoned that compared with more open landscapes, humans might have found rainforests too difficult to navigate, with less available food to hunt or catch.
Also Read
"This is the first time scientists have investigated ancient human fossils in a tropical forest context to see how our earliest ancestors survived in such a habitat," co-author Professor Julia Lee-Thorp from Oxford University said.
The researchers studied the fossilised teeth of 26 humans of a range of dates. All of the teeth were excavated from three archaeological sites in Sri Lanka, which are today surrounded by either dense rainforest or more open terrain.
Only two of them showed a recognisable signature of a diet found in open grassland. However, these two teeth were dated to around 3,000 years, the start of the Iron Age, when agriculture developed in the region.
"This is the first study to directly test how much early human forest foragers depended on the rainforest for their diet," lead author Patrick Roberts said.
"The results are significant in showing that early humans in Sri Lanka were able to live almost entirely on food found in the rainforest without the need to move into other environments. Our earliest human ancestors were clearly able to successfully adapt to different extreme environments," said Roberts.