(Rosanna Tasker for The Washington Post)

When our cherry tomatoes blush red each summer, my son eagerly plucks them from the vine and pops them in his mouth. He points at random plants and proudly declares, “That one’s mine!” And occasionally, he yells in panic as the hose from the rain barrel overflows his tiny watering can.

Admittedly, gardening with kids isn’t always idyllic.

But even when it’s chaotic, it can be tremendously beneficial. Scientific research suggests that getting up close and personal with dirt can improve children’s mental and physical health. Gardening can help kids burn off extra energy and control their impulses, develop strong immune systems, and willingly consume more fruits and vegetables. What’s not to like?

And despite the gloomy news from studies showing that tweens and teens spend an average of six to nine hours a day on screens, more families with kids are gardening now than 10 years ago. According to the National Gardening Association, gardening in households with children increased by 25 percent from 2008 to 2013, as families have awakened to the hidden benefits of the ancient pastime.

The calming effect of the outdoors

Even when my 4-year-old is bouncing off the walls, he visibly relaxes when we head outdoors, finding the self-awareness to avoid stepping on delicate plants. Similarly, my 1-year-old stops whining and focuses on drawing in the dirt.

(Rosanna Tasker for The Washington Post)

My kids aren’t alone. The natural stimulation of being outside seems to replenish minds exhausted from practicing self-discipline. It re-energizes the part of the brain that controls concentration, checks urges and delays gratification.

A study of 169 girls and boys in a public housing development in Chicago found that girls who had greener views from their apartments did better on tests that measured self-discipline. Of the range in test scores, one-fifth of the variation could be explained by the differences in the “greenness” of the kids’ surroundings.

These benefits may be even greater for children with attention-deficit disorder. A survey of 96 families in the Midwest asked parents which activities appeared to decrease their child’s symptoms and which seemed to increase them. Parents consistently chose “green” activities as having a positive effect on their child’s symptoms.

“Most of us have a pretty significant nature deficit and would be healthier if we could address that deficit by spending a little more of our time in an outdoor setting,” says Robert Zarr, founder of Park Rx America and a pediatrician in the District. Park Rx America encourages doctors and other health providers to “prescribe” time in nature.

And that time in nature may even allow us to use our senses in new ways, experts say.

“It’s about planting the plant and watching it grow, but it’s also about other things,” says Richard Louv, author of “Last Child in the Woods” and co-founder of the Children & Nature Network. “It’s about turning over the rocks. It’s about getting your hands muddy and your feet wet. It’s about using more of your senses. It’s about being in the world.”

Gardening combines the general benefits of being outside with the opportunity to tackle a project. My 4-year-old proudly waters the blueberry bushes and weeds around the garden fence. He’s building his ability to focus as well as his executive function, or capacity to manage information and react to situations. For example, he quickly learned that his watering can will overflow if he doesn’t pay attention. And older children can take responsibility for their own green space.

“If the kid has a solitary experience creating his or her own garden, there’s a special magic to that,” Louv says.

Eating dirt can be good

My 1-year-old isn’t old enough to do anything in the garden, but he joins us out there anyway. He spends most of his time playing in — and attempting to eat — the dirt. When I catch him, he looks up with a vaguely guilty expression and dirty smudges around his lips. It sounds gross, but his soil ingestion may actually be a good thing.

Research suggests that it’s essential for young children to develop a healthy “microbiome,” or personal microbe ecosystem. Although there are some microbes — bacteria, fungi and viruses — that make us sick, many more are essential to our health.

“The immune system is there to act like a gardener or a national park warden,” says Jack Gilbert, a microbiologist at the University of Chicago and co-author of the new book “Dirt Is Good.” “It’s there to promote the abundance and growth of good bacteria and act as a barrier to the generation of bad bacteria.”

Not being exposed to enough microbes as a child can result in an underdeveloped immune system, which can cause a host of problems, according to Gilbert, including autoimmune diseases, inflammatory bowel disorders and allergies. Being around dirt, in the garden or otherwise, can help kids develop that healthy microbiome that helps prevent these issues.

“Picking up soil and smudging it into their face, there’s nothing wrong with that,” Gilbert says. “Exposure to the outside environment . . . can be extremely beneficial in helping your child to grow a functional immune system and their brain and their body in the best way possible.”

Garden to dinner table

Active involvement in a garden can also make kids more willing consumers of vegetables, including unfamiliar varieties. My older son is definitely a more adventurous eater. My 1-year-old, meanwhile, doesn’t know the difference yet. Participating in the planting, watering and especially harvesting of vegetables creates a connection that you just can’t get from a trip to the supermarket.

This seems to be a pretty common experience. An analysis that looked at 14 studies of school, community and after-school garden programs found that in 10 of them, children ate more fruits and vegetables after participating in the program .

Mateja R. Savoie-Roskos, the lead author of that analysis and an assistant professor of nutrition, dietetics and food science at Utah State University, encourages parents to involve their kids throughout the season, from planting seeds and watering through harvesting.

“We want our kids to know how food grows and how we even get the food that we have,” Savoie-Roskos says.

Finding a space for gardening

Our family is lucky to have a dedicated outdoor space for plants. But even parents who don’t have a back yard have options.

Park Rx America’s database of green space, which includes hundreds of locations in the Washington area and thousands across the country, has a filter that allows users to find parks with community gardens. There are also many independently run community gardens, and school gardens are becoming increasingly popular. As of 2013, more than 30 percent of schools in the United States had gardens, an increase of about 12 percent from 2006, according to a study in the Journal of School Health. Children can even bring a little bit of nature to their deck or fire escape with a container garden.

Whether in your own little plot or as part of a larger space, gardening can provide children with a variety of benefits few other activities can.

Or as Louv says, “A garden can be a doorway into a larger universe.”

Shannon Brescher Shea is a science writer who also blogs about parenting and green living at We’ll Eat You Up, We Love You So. You can find her on Twitter @storiteller.