By Jesse Newman

More U.S. farmers are filing for bankruptcy, as federal payments projected to reach record levels this year fall short of compensating for the coronavirus pandemic and a yearslong slump in the agricultural economy.

About 580 farmers filed for chapter 12 bankruptcy protection in the 12-month period ended June 30, according to federal data. That was 8% more than a year earlier, though bankruptcies slowed slightly in the first half of 2020 partly because of an infusion of federal aid and hurdles to filing during the pandemic, according to agricultural economists and attorneys.

The pandemic has pressured prices for many commodities, squeezing farmers who raise crops and livestock, and prolonging a six-year downturn in the Farm Belt.

The Trump administration is expected to dole out a record $33 billion in payments to farmers this year, according to the University of Missouri's Food and Agricultural Policy Research Institute. The funds, including those intended to help farmers hurt by trade conflicts and the coronavirus, would push government payments to 36% of farm income, the highest share in nearly two decades, the institute said.

"Agricultural markets have been horrible, and the pandemic exacerbated it, big time," said Paul Swanson, an Oshkosh, Wis.-based attorney. He said he has 40 open farm-bankruptcy cases, about a third more than last year.

Mr. Swanson said some clients who received federal coronavirus aid still wound up in bankruptcy. "The cash came in, the cash came out," he said.

Before the pandemic, a global grain glut and foreign competition had pushed down agricultural prices. Trade disputes deepened the pain, drawing retaliatory tariffs from top buyers of U.S. farm commodities, such as China and Mexico.

Then the coronavirus hit, upending the U.S. food-supply chain. As restaurants closed, farmers plowed under thousands of acres of vegetables and dumped milk into manure lagoons. Corn prices plummeted as Americans stopped driving, cutting demand for ethanol, a corn-based biofuel blended into gasoline. Prices for slaughter-ready cattle and hogs dropped as meatpacking plants that became virus hot spots slowed or halted production.

Hog farmers have lost nearly $5 billion in actual and potential profits for 2020, according to the National Pork Producers Council, a trade group. In California, agricultural businesses stand to lose as much as $8.6 billion, according to a study commissioned by the California Farm Bureau Federation.

Wisconsin dairy farmer Art Steffen filed for bankruptcy in January, before coronavirus arrived but after years of low milk prices and mishaps on his farm left him with $3 million in unpaid bills, including $400,000 for animal feed and $2,000 for cattle semen and other breeding supplies.

Mr. Steffen, who sells the milk from his 300 cows to a string-cheese plant, said filing for bankruptcy made him feel he had failed as a steward of the farm that has been in his family since the 1860s.

Mr. Steffen withdrew his bankruptcy filing in June to qualify for a forgivable loan under the federal government's Paycheck Protection Program. He received roughly $40,000, enough to pay his four employees for less than three months. He also received $97,000 from the administration's coronavirus-relief program.

Mr. Steffen spent those funds on animal feed and electricity. In July, he refiled his bankruptcy case. "The mission is to survive and pay people what you owe," Mr. Steffen said.

Chapter 12 bankruptcy, created during the 1980s farm crisis, allows distressed family farmers or fishermen to devise a plan to repay creditors over three to five years. Farms with debts that don't exceed $10 million may file for the protection.

Lynn Hicks, who milks 70 cows on a farm 200 miles northwest of Mr. Steffen's, said she hasn't secured government aid because she is also in bankruptcy. As funds dwindled, Ms. Hicks and her husband, Nick Hicks, appealed to suppliers to wait until they were paid for their milk to cash their checks. They became a grass-fed dairy to eliminate grain costs. Ms. Hicks opened a furniture-refinishing business to supplement the family's income.

"A lot of tears have been shed," she said.

Trouble for many farmers extends back to a commodity boom beginning in 2006 that encouraged them to borrow heavily, said Patrick Westhoff, director of the Food and Agricultural Policy Research Institute.

U.S. farm debt has grown steadily since then to more than $425 billion this year, the U.S. Department of Agriculture estimates. That is the largest sum since a farm crisis in the 1980s that pushed many farmers and lenders out of business.

"There are a lot of people that have been hanging on for a long time that needed a positive development, and this year hasn't provided that," Mr. Westhoff said. "It's been just the opposite."

Buoyed by $16 billion in direct payments to farmers to mitigate pandemic-related losses, farm income might tick down just 3% this year to $90.6 billion, the Food and Agricultural Policy Research Institute predicted in June. As of this week, less than $7 billion of the funds had been distributed, according to USDA.

Trade aid and coronavirus-relief payments are due to end this year. Agricultural economists say more farms could fold next year without additional support. Slow purchases from China and the pandemic's persistence continue to weigh on demand for agricultural products.

If more aid isn't extended, farm income is expected to fall 12% to $79.4 billion in 2021, according to the Food and Agricultural Policy Research Institute. Government payments would drop by half to less than $17 billion.

Congress is debating further financial support for farmers, and USDA could offer more aid from the $14 billion earmarked earlier this year to replenish the Commodity Credit Corp., a funding mechanism for agriculture. A spokesperson said USDA is evaluating the impact of Covid-19 on agriculture as it considers a second round of payments.

"It's hard to pinpoint the damage when you're in the middle of the hurricane," said John Newton, chief economist at the American Farm Bureau Federation. "Sure, half the house is still standing, but this thing is not past us yet."

Write to Jesse Newman at jesse.newman@wsj.com