WASHINGTON — Peppered with complaints from farmers fed up with President Trump’s trade war, Sonny Perdue found his patience wearing thin. Mr. Perdue, the agriculture secretary and the guest of honor at the annual Farmfest gathering in southern Minnesota this month, tried to break the ice with a joke.

“What do you call two farmers in a basement?” Mr. Perdue asked near the end of a testy hourlong town-hall-style event. “A whine cellar.”

A cascade of boos ricocheted around the room.

American farmers have become collateral damage in a trade war that Mr. Trump began to help manufacturers and other companies that he believes have been hurt by China’s “unfair” trade practices.

More than a year into the trade dispute, sales of American soybeans, pork, wheat and other agricultural products to China have dried up as Beijing retaliates against Mr. Trump’s tariffs on Chinese imports. Lucrative contracts that farmers long relied on for a significant source of income have evaporated, with Chinese buyers looking to other nations like Brazil and Canada to get the commodities they need. Farm bankruptcy filings in the year through June were up 13 percent from 2018 and loan delinquency rates are on the rise, according to the American Farm Bureau.