Herbs and vegetables grown in New York City community gardens are loaded with lead and other toxic metals, a startling state study shows.

Tainted vegetables — some sold in city markets — were found in five of seven plots tested, according to data obtained from the study by The Post through the Freedom of Information Law.

Most of the root vegetables sampled far exceeded safe thresholds for lead, with the most toxic being a carrot at the Hart to Hart community garden in Bedford-Stuyvesant, Brooklyn.

It contained 1.95 parts per million of the toxic metal — nearly 20 times the level considered safe, according to state Health Department data.

You’re playing Russian roulette with this… There is no known safe level of lead exposure. - Howard Mielke

“If they don’t know what the level of lead is in the garden, it would be advisable not to grow root crops,” said study co-author Murray McBride, a Cornell University professor of soil chemistry.

Lead in some herbs — for which there is no available safety standard — was off the charts.

Dried basil from the Classon-Fulgate garden in Clinton Hill, Brooklyn, had 11 parts per million of lead.

Dried thyme at Hart to Hart was found with 18 parts per million of lead.

“You’re playing Russian roulette with this,” said Howard Mielke, a Tulane Medical School pharmacologist who reviewed the data for The Post.

“There is no known safe level of lead exposure.”

In the study, scientists used safety levels set by the European Union for lead and cadmium, since the United States doesn’t set a threshold for veggies.

Once in the body, lead can remain for 30 years, causing permanent learning disabilities, behavioral issues, hearing problems, heart disease, kidney disease, schizophrenia, Alzheimer’s and death.

Children, pregnant women and sick people are most vulnerable to lead poisoning, experts said.

Shoppers at a farmers market outside East New York Farms in Brooklyn — where a carrot was tested with nearly three times the safe amount of lead — were stunned by the study.

“I thought it would have been more natural getting it from here than anywhere else,” said one 38-year-old grazer.

Donel Lykes, 68, said he noticed something funny about the veggies there.

“Their vegetables, for whatever reason, are not as tasty as the ones you get in the store,” he said.

A 55-year-old shopper said she leaves it up to the jolly green giant in the sky.

“I buy from the community garden,” she said. “I pray before I eat it that anything in there won’t kill me.”

The veggie data were compiled by researchers at Cornell and the state Center for Environmental Health and published this summer in the journal Environmental Pollution.

The Post had to file a Freedom of Information request to learn the locations of the gardens where the toxic plants were grown.

Councilman Corey Johnson, chairman of the council’s Health Committee, called the findings “extremely alarming.”

“New Yorkers are using these community gardens to grow their own vegetables, which poses a serious health risk given that the ingestion of lead can cause permanent brain damage and even death,” said the Manhattan Democrat, who urged increased awareness and testing.

A previous soil study by the same researchers found lead levels above federal soil guidelines at 24 of 54 city gardens, or 44 percent of the total, and overall toxic soil at 38 gardens — 70 percent of the total.

Safety is a top priority in all our green spaces, and we have been working…to ensure all food grown is safe to eat. - Tara Kiernan, Parks spokesperson

The Parks Department said gardens involved with the study have all received clean soil and compost.

“Safety is a top priority in all our green spaces, and we have been working closely with community gardens to ensure all food grown is safe to eat,” Parks spokeswoman Tara Kiernan said.

The department oversees about 600 community gardens, most of which grow fruits and vegetables.

“Members can choose to sell at markets if they like,” Kiernan said.

Mielke urged growers not to bury their heads in the soil.

“The gardening community needs to be concerned about this,” he said. “You want people to have fresh vegetables, but if they are growing them in gardens in contaminated soils, it’s counterproductive.”

Additional reporting by Ben Feuerherd