A. K. M. Kamaluddin Choudhury munched peanuts and cheered for the Royals when he attended his first baseball game earlier this month -- courtesy of America's wheat farmers, who want his country to buy their grain.

Choudhury, chief civil servant in the Bangladesh ministry of food, is a popular man with grain producers around the world. He turned down an invitation to visit Bangkok because he didn't think Bangladesh would buy rice from Thailand this year, and said he is likely to have one of his aides accept an invitation from Canadian wheat farmers.

His visit here was part of an effort by U.S. Wheat Associates, the international marketing arm of the wheat industry, to sell more American grain overseas. In the process, the organization is trying to shift eating habits of much of the world away from other grains to wheat -- increasing the potential market during a global glut of wheat.

Exports are vital to American farmers. As recently as 1980, about two of every three bushels of wheat American farmers produced went overseas. Exports now have dropped to less than half of U.S. wheat production, leaving bulging American grain elevators as overseas markets have been drying up and the global competition for sales has intensified.

Countries such as India and China, once major wheat buyers, now produce enough to feed themselves and have entered the export market. China is becoming a major grain producer, with corn output up 15 percent a year since 1982, rice output up 20 percent and wheat output up 40 percent. Even the desert kingdom of Saudi Arabia, using its oil wealth to subsidize its farmers, produces enough wheat to feed itself, and the U.S. Agriculture Department predicted last week that the Saudis may become net wheat exporters this year.

In all, new production techniques and an increased emphasis on promoting agricultural self-sufficiency have converted 30 nations from food buyers to food sellers.

The global glut of grain contradicts the theory of Thomas Malthus, the 19th-century political economist, that world population would outstrip the available food supply. Currently, there is more than enough food grains to feed the 5 billion people on Earth. Famine remains a problem in some areas, however, because of poverty and politics that keep hungry people from getting the food they need.

In 1984, Western Europe produced more wheat than the United States for the first time since the opening of the American West more than 100 years ago. A Cornell University study predicted the European Community could supplant Canada as the world's No. 2 wheat exporter by the end of this decade and push past the United States in the 1990s to take the top spot.

All this means lower prices and fewer sales for America's farmers, who are getting increasingly restive as they see their neighbors losing their farms and see elevators full of last year's unsold grain as they harvest a new crop.

"We're kind of getting the shaft," said Cecil (Gene) Vining, as he worked with a tractor to build terraces on rich black soil in Richmond, Kan., about an hour's drive from here.

Now he questions the wisdom of buying the land, especially since four close neighbors have been forced to sell their farms. "When it gets that many that close, it gets scary," Vining said.

He blames hard times on the slowdown of exports. "Look at all the exporting countries that were importing countries a few years ago," he said. "We told them too much and made them direct competitors."

He also cited low-cost World Bank loans to improve farming in South American nations such as Argentina and Brazil as a cause of the American farmers' export woes. "I'd like a 5 percent loan," Vining said. "Our dollars go down there to help our direct competitors."

The Agriculture Department predicted the lowest farm trade surplus this year since 1972 -- $7 billion -- and the Commerce Department reported last month that the nation sustained its first deficit in agricultural trade in 27 years in May. U.S. grain sales overseas fell to 16.5 million tons in the five months that ended in February, a 16 percent drop from the same period the year before.

"The competition is not going to go away," said Timothy M. Oviatt, the head of the U.S. Wheat Office in Singapore, who accompanied the Bangladesh group through this country.

Nonetheless, there are some bright signs for the future in the latest Agriculture Department forecast, with wheat sales in the upcoming year up 19 percent, corn up 13 percent, soybeans up 74 percent and cotton up 227 percent.

Even so, farm-state lawmakers are intensifying their pressure on the Reagan administration to increase programs to boost agricultural exports. Senate Majority Leader Robert Dole (R-Kan.) wrote President Reagan urging broader export-promotion programs. Dole also favors offering subsidized grain sales to the Soviet Union, which many in the Reagan administration oppose.

But the Soviets, America's largest wheat customers, backed off purchases when they found they were excluded from the administration's "export enhancement program" to win markets back from the EC.

There were expectations in America's Farm Belt that the April nuclear disaster at Chernobyl would lead to increased Soviet grain purchases, and wheat futures trading at the Kansas City Board of Trade registered sharp gains over three days. But that proved to be a blip on the otherwise dismal price picture as the futures market quickly dropped back.

But with Soviet grain purchases enmeshed in politics and apparently on the downswing this year, U.S. wheat producers are looking to secondary markets such as Bangladesh, which the World Bank lists as the second-poorest country in the world behind Ethiopia.

Called "the basket case of the world" by Henry Kissinger, Bangladesh needs more than 16 million tons of rice and wheat to feed its more than 100 million people. Most of the 1.1 million tons of wheat it imported last year was food aid, including 331,000 tons from the United States. But Bangladesh bought 90,000 tons of wheat, all from the United States, on the commercial market, a drop from the 645,000 tons purchased the year before. U.S. farmers sold the bulk of that wheat, 461,000 tons, making Bangladesh the ninth-largest purchaser of American wheat in 1984.

"They have the potential to be a major buyer," said Jim Bair, a marketing specialist with the Kansas Wheat Commission, who escorted Choudhury and F. H. Khan, director of procurement in Bangladesh's Ministry of Food, through the heartland of the American Farm Belt earlier this month.

Bangladesh is largely a nation of rice eaters, but Bair says wheat is more nutritious and half the cost of rice, meaning Bangladesh can feed its people better at a lower price. "It's a matter of changing people's taste," he said.

U.S. Wheat Associates projects that Bangladesh will buy more wheat in the future, as food grants and low-interest-loan funds dry up. Part of the two-week food trade mission -- which took Choudhury and Khan to California, Oregon, the Port of New Orleans, New York and Washington as well as the Kansas Wheat Belt -- is to familiarize Bangladesh wheat buyers with U.S. production and export facilities.

The Bangladesh group was one of about 25 teams from 20 countries that annually visit the United States in what U.S. Wheat believes is one of its most effective selling tools. "Only with a broad knowledge of how the U.S. system functions and the many advantages associated with it can the major importers of the world be expected to increase their purchases of U.S. wheat," said Winston Williams, president of U.S. Wheat.

Choudhury said Bangadesh has gained self-sufficiency in rice, and doesn't want to import any because added stocks would disrupt prices paid to domestic farmers. Corn exporters have been trying to get Bangladesh to buy their product, but Choudhury said the price is not much lower than wheat and people are not used to eating corn. He added that Bangladesh may buy some, though, as feed for lifestock or poultry.

He didn't commit himself on wheat purchases from the United States this year, although U.S. Wheat officials say they are optimistic.

The added sales are badly needed by American wheat growers, whose bumper crops are filling Farm Belt grain elevators. In nearby Ottawa, Kan., the farm-cooperative grain elevator is nearly full with grain owned by farmers who are unwilling to sell at the current low prices, and Adrian Derousseau, of the cooperative, is considering getting a $120,000 loan to buy temporary storage.

"If we don't do that, I don't know what we're going to do," he said. "I've called every terminal in Kansas, and no one will take any grain."

The cost to the U.S. government of buying and storing surplus grain is expected to soar above $20 billion this year, a record, according to Agriculture Department estimates.

"That's why we have things like export enhancement. What else are we going to do with all this grain?" asked Bair of the Kansas Wheat Commission.