The finding emerges from the long-running Dunedin Multidisciplinary Study, which has followed the progress of 1037 participants born in 1972-1973 into adulthood.
The study, which appears in the August issue of the US journal Pediatrics, suggests that childhood exposure to microbial organisms through thumb-sucking and nail-biting reduces the risk of developing allergies.
Study lead author Professor Bob Hancox says this exposure may alter immune function so that children with these habits become less prone to developing allergy.
Parents of Dunedin Study members reported their children's thumb-sucking and nail-biting habits when their children were 5, 7, 9, and 11 years old.
The members were checked at ages 13 and 32 years old for atopic sensitisation, defined as a positive skin prick test to at least one common allergen.
At age 13, the prevalence of sensitisation was lower among children who had sucked their thumbs or bit their nails (38 percent) compared with those who did not (49 percent).
Children who both bit their nails and sucked their thumbs had an even lower risk of allergy (31 percent), Professor Hancox says.
The associations were still present at age 32 years and persisted even with adjustments for confounding factors such as sex, parental history of allergies, pet ownership, breast-feeding and parental smoking.
"The findings support the "hygiene hypothesis", which suggests that being exposed to microbes as a child reduces your risk of developing allergies," he says.
Despite these findings, Professor Hancox and his co-authors do not suggest that children should be encouraged to take up these habits, because it is unclear if there is a true health benefit.
Ms Stephanie Lynch, a medical student who undertook the study as a summer project, says "although thumb-suckers and nail-biters had fewer allergies on skin testing, we found no difference in their risk for developing allergic diseases such as asthma or hay fever".