SCARBOROUGH, Maine — Foraging for insects, tender roots and other delicacies in a 4-acre pasture, a passel of Berkshire and Tamworth hogs are happy — at least as happy as pigs in mud can be.

It’s a hot August afternoon, and the swine poke out from the shade when workers from Frith Farm arrive with fresh feed and water. In a few weeks these hogs will be harvested. And, by the time you read this, the auburn-colored chickens, clucking nearby in moveable shelters, will be processed and either sold at a farmers market or available in the farm’s barn-turned-store.

In the five years this Scarborough-based organic farm has been up and running, demand for local poultry and beef has soared.

“This food is community building,” Alex Ethier, Frith Farm’s livestock manager, said. “It’s food that’s right in your own backyard.”

From pastured chickens, pigs and turkeys to grass-feed beef and lamb, meat that is humanely raised on neighborhood farms is becoming more mainstream and less novelty. Spurred by an educated locavore public concerned with food scares and pink slime and hip to jarring documentaries such as “Food Inc.,” knowing where your beef comes from is on the rise across the U.S.

In Maine, more farmers are raising animals to offer consumers a full farm, not factory, diet. According to the Maine Organic Farmers and Gardeners Association, the number of certified livestock producers in the state increased by more than 20 percent in less than three years.

“Farms are diversifying, and this manages the money flow,” said Diane Schivera, organic livestock specialist at MOFGA, who said in 2012 there were 96 certified livestock producers in Maine. This year that number rose to 120.

Raising animals for food is a time-consuming endeavor. Infrastructures have to be in place, irrigation and feeding systems tight, and land plentiful.

Growing cattle for beef can take up to 3½ years. But an eager public awaits. According to Maine Department of Agriculture, Conservation and Forestry data, demand for local meat has grown steadily over the last few years.

In 2009, a total of 2,217 animals — from steer to goats to bison — were slaughtered at the state’s five plants. Four years later, that number jumped to 2,740. Because this meat has to be sold in the state, the uptick points to shifting local appetites.

“Pastureland is being utilized now more than it was in 2009,” Henrietta E. Beaufait, who handles meat and poultry inspection for the state. “We don’t have big commercial feedlots here, said. A lot of the steer and sheep and lambs and beef cows are given their feed off of pasture.”

That makes them all the more valuable.

Farms such as North Branch Farm in Monroe don’t have to advertise their grass-fed beef. It sells itself.

“We sold out quicker this year. Last year we had one or two (cows) not spoken for at this time. Partly it’s word of mouth,” said co-owner Elsie Gawler, whose herd includes American Milking Devons and Jersey hybrids sold by the quarter, half or whole.

This year the eight cows marked for slaughter were claimed in record time. The 50-cent-per-pound price increase was no deterrent.

Once people visit the source and try local steak, short ribs and ground beef, they are converts.

“When people come to the farm and meet the cows, they have much more of a connection to their food, and that’s becoming more important to people,” Gawler, who runs the 330-acre horse-powered farm with three partners, said. “It’s an attraction to know right where the food is coming from, see the place where it is raised and meet the people who raise it.”