In just a few weeks, U.S. farmers will begin harvesting tens of millions of tons of soybeans. But they have a big problem on their hands: The world’s biggest buyer doesn’t want any.

Over the years, China had become one of the biggest buyers of American agricultural products, as the country’s growing middle class developed a taste for pork and poultry that are fattened, in part, on soybean meal. U.S. farmers in turn rushed to cash in on China’s ravenous demand.

But now, soy has emerged as a potent weapon that Beijing is wielding in its trade fight with Washington. Chinese buyers haven’t booked any U.S. soybean purchases, turning instead to Brazilian suppliers. Around this time last year, American soy farmers had already booked large purchases from Chinese buyers, said Jim Sutter, Chief Executive Officer of the U.S. Soybean Export Council.

Chinese negotiators have suggested that China would buy more U.S. soybeans as part of talks aimed at ending a trade war that erupted earlier this year after the Trump administration slapped stiff tariffs on Chinese imports.

Pork is prepared for sale in China, where farmers fatten pigs in part on soybean meal.

But Beijing has insisted that the administration first drop the 20% tariff the U.S. has imposed over China’s role in the fentanyl trade, say people familiar with the matter. Washington is reluctant to do that until Beijing takes serious measures to crack down on the trade in chemicals used to produce fentanyl.

China has already used key products to pressure the U.S. Earlier this year, it choked off the supply of rare earths that are critical in manufacturing cars, electronics and defense equipment. After an outcry from American businesses, the administration gave in to Chinese demands to loosen controls on the export of some tech products to China.

Now, it is U.S. farmers who are feeling the pain. Nearly a quarter of the more than 4 billion bushels of soybeans American farmers grow each year are exported to China, which is by far the world’s biggest soy importer. The country imported nearly $13 billion of soybeans from the U.S. last year, compared with about $2 billion two decades ago.

At a recent farm show in Illinois, Caleb Ragland, a Kentucky soybean farmer and president of the American Soybean Association, said there isn’t enough domestic or international demand to make up for China. Crop prices have fallen as a result.

“We have a large number of farmers that won’t survive this,” Ragland said. Farm trade groups are pressing the Trump administration for a bailout for farmers. U.S. soybean farmers are projected to lose roughly $100 an acre this year, according to federal data.

Chinese companies have increasingly turned to Brazilian soybean producers.

China says U.S. farmers are suffering collateral damage from their government’s confrontational trade approach. “After confusion and chaos in the plowing season, our farmer friends may soon have to face new uncertainty in the harvest season,” Chinese Ambassador Xie Feng told a U.S. soy industry conference in August.

China has been aggressively stockpiling agricultural products, enabling it to weather a prolonged fight. Its soy inventories currently exceed what it typically imports from the U.S. each year.

President Trump has asked the Chinese to quadruple their soy purchases, asserting on Truth Social last month that Beijing is “worried about its shortage of soybeans.”

Starting in the 1990s, American farmers responded to soaring Chinese demand by shifting millions of acres away from crops such as wheat. Soybean acreage in the U.S. grew nearly 40% from 1995 to 2024, according to Agriculture Department data. Seed and pesticide companies, grain traders and railroads have spent billions of dollars creating new varieties of seeds, building plants that crush and process beans into oil and adding rail and port capacity in the Pacific Northwest to ship crops to China, where soy imports have risen 50% over the last decade.

But a turning point came when Trump placed tariffs on China during his first term. Chinese imports of U.S. soybeans plummeted, devastating U.S. farmers. The government sent about $23 billion to farmers in total to compensate. While exports recovered in the following years, China has been steadily squeezing American farmers out.

Chinese companies increasingly turned to Brazil, stepping up infrastructure investments in the country’s vast agricultural hinterland. China has invested heavily in ports, railroads and silos to transport crops from Brazil, which last year provided 70% of China’s soy imports, double the share from 15 years ago.

American soy farmers say they are preparing to lose China as a major buyer.

Cofco, a Chinese state-owned agricultural giant, is developing a massive port terminal on Brazil’s Atlantic coast for soy and corn exports. In July, it announced the purchase of nearly 1,000 rail wagons to transit crops through Brazilian countryside to the port.

China has also stepped up imports of Argentine soy from January through July this year, relative to the same period last year, and tripled imports from Uruguay, according to Chinese customs data.

Food security remains a concern for Chinese leaders. The huge country relies on imports for important foods such as meat and vegetable oil and has struggled in vain for years to significantly boost domestic soybean production. But even large-scale subsidies haven’t been enough to convince many farmers to switch to soy, where they compete against low-cost imports from Brazil.

China’s government has taken other steps to curb its reliance on U.S. soy, including pushing hog farmers to reduce the amount of soy they feed their pigs.

Muyuan Foods, one of the world’s largest pig operations, with more than 70 million pigs sold last year, said that new nutrition technology has allowed it to reduce soymeal to about 7% of its total pig feed in 2024, compared with an industry standard of around 10-17%. The company shared its feed formula with the wider industry, which it says has led to widespread reductions in the use of soy for pig feed.

Meanwhile, American soy farmers say they are preparing for a future where China is no longer a major buyer.

They are cutting back on purchases of new machinery and fertilizer. Industry trade groups are pressing D.C. lawmakers to find new export markets and expand the amount of soybean oil blended in diesel. Growers advocate for new domestic uses of the oilseed, such as increased use of soybean-based asphalt to pave roadways.

“Unless something miraculous happens, I’m not going to plan on China taking our soybeans,” said Andy Hill, a corn and soybean farmer on nearly 1,000 acres in north central Iowa.

Write to Jon Emont at jonathan.emont@wsj.com and Patrick Thomas at patrick.thomas@wsj.com