Shoppers examine produce at a farmers market. To avoid food poisoning, wash all fruits, vegetables and fresh herbs under running water right before eating, cutting or cooking. (Alex Katz/AP)

Consumer Reports has no financial relationship with any advertisers on this site.

For many people, weekend mornings aren’t complete without a trip to the farmers market, which may explain why there are more than 8,700 registered in the Agriculture Department’s Farmers Market Directory.

And there are good reasons to shop at them: Farmers markets may offer fresh, locally grown food that isn’t available at your supermarket.

But research suggests that fresh and local doesn’t always mean safe to eat. A Penn State study published in November in the journal Food Protection Trends assessed food safety behaviors of vendors at more than 40 Pennsylvania farmers markets and found many didn’t follow basic sanitary practices. As a part of this investigation, published in an earlier study, the researchers also found harmful bacteria in meat and produce sold at the markets.

“A lot of people assume that because a food is produced locally it’s safer, but that’s not the case at all — it comes down to what kind of food safety practices the vendor uses,” says Judy Harrison, professor and extension food safety specialist at the University of Georgia. (Harrison was not involved in the study.)

What the study found

The researchers found large discrepancies between the food safety precautions farmers market vendors claimed they were taking and what the researchers observed them doing.

For example, although more than a third of vendors claimed to use disposable gloves, researchers found that less than a quarter had them at their stands. And among those who did use gloves, about half used them improperly by not changing them when they were supposed to — such as after handling raw meat or money. “The vendors appeared to believe that they were taking appropriate measures, not realizing that they were wearing or using gloves incorrectly,” says study author Catherine Cutter, professor of food science at Penn State University College of Agricultural Sciences.

In addition to other factors, such as contamination on the farm, poor hygiene could help explain why levels of bacteria that could potentially cause food poisoning were so high in the food sold at these markets: E. coli was present in 40 percent of beef samples, 18 percent of pork samples, almost a third of lettuce and kale samples, and 17 percent of spinach samples. Listeria was found in 8 percent of beef, 2 percent of kale, 4 percent of lettuce and 7 percent of spinach.

Although these types of bacteria can often be destroyed through proper cooking at home, “consumers should still expect the same level of food safety practices at farmers markets as they do at regular markets, because the possible negative outcomes are the same,” says James E. Rogers, director of food safety research and testing at Consumer Reports.

How to shop

This new study shouldn’t keep you from enjoying the bounty of the local farmers market, however. “Not all farmers markets are the same, and this is one study,” says Rogers. “But it does show that consumers need to be aware of the food safety issues related to farmers markets and take some precautions.”

Keep these food safety tips in mind:

Observe vendors carefully. Vendors should use gloves whenever they handle food and should change them whenever they move from raw to ready-to-eat or cooked foods. They should also change them when they stop handling food to do activities such as managing the cash register or answering the phone. This is especially important with ready-to-eat-foods, Rogers says. “Raw foods that are to be cooked tend to be safer when properly prepared because you have the cooking temperature as a ‘kill step’ for any bacterial contamination,” he says. “But unless you are very sure that any ready-to-eat food that is purchased has been prepared and stored at the proper conditions, I would tend to avoid them.”

Stay away from raw milk and raw-milk cheeses. Don’t buy milk or cheese at a farmers market unless you can confirm that it has been pasteurized, a process that kills dangerous bacteria. “The Centers for Disease Control and Prevention has identified raw milk as the most dangerous raw-food product,” Rogers says. This is true even if the farmers tell you they have performed laboratory tests for bacteria in raw-milk products, according to the CDC, because milk that is safe one day might not be safe the next. In addition, unpasteurized juice and cider could potentially harbor harmful bacteria.

Buy perishables last. Get anything that needs to be kept cold — such as meat, chicken and eggs — at the end of your trip, to reduce risk of it spoiling. Make sure that the vendor has kept them refrigerated or stored in iced coolers. And bring your own cooler or insulated bag to keep your meat cool and separated from fresh produce on your way home to avoid cross contamination, says Faith Critzer, associate professor and produce-safety extension specialist at Washington State University.

Practice food safety at home. “It’s important to follow the four C’s — cleaning, cooking, preventing cross contamination and chilling,” Cutter says. This includes washing all fruits, vegetables and fresh herbs under running water right before eating, cutting or cooking them even if you’re planning on peeling them, because any bacteria on the surface can be transferred to the inside. Just dry them if you’re not using them right away, because moisture can encourage bacteria to grow, Cutter says.

It’s also a good idea to invest in a meat thermometer to ensure that food is cooked enough to kill disease-causing bugs. Whole cuts of beef should be cooked to an internal temperature of 145 degrees, ground beef to 160 degrees and poultry to 165 degrees.

“This way, even if some of the food you do bring home from the farmers market contains bacteria, you’re making sure you kill it before you consume it,” Cutter says.

 Copyright 2018, Consumer Reports Inc.

Consumer Reports is an independent, nonprofit organization that works side by side with consumers to create a fairer, safer, and healthier world. CR does not endorse products or services, and does not accept advertising. Read more at ConsumerReports.org.