The United States and the Soviet Union have agreed on a new long-term grain agreement that will increase substantially the amounts of corn and wheat that the United States sells to the Soviets.

Secretary of Agriculture John R. Block and U.S. Trade Representative William E. Brock said that the five-year agreement, which begins Oct. 1, will commit the Soviet Union to buy an annual minimum of 9 million tons of grain, a 50 percent increase from the current 6 million tons.

The current agreement, due to expire Sept. 30, was twice extended for one-year periods by the Reagan administration, which had refused until late last year to negotiate a longer-term pact as relations between Washington and Moscow deteriorated.

Yesterday's surprise announcement came as the Reagan administration was making new accusations about the Soviets fueling leftist subversion in Central America. Citing this, Sen. Daniel Patrick Moynihan (D-N.Y.) urged that grain sales to the Soviet Union be ended rather than expanded.

"If we are going to feed the Russian army," Moynihan said yesterday, "what right have we to complain about the way in which the Russian army conducts itself or the way the Soviet Union causes trouble anywhere in the world it can find an opportunity to do so?"

Former president Carter imposed a partial embargo on U.S. grain sales to the Soviets in January 1980 after the Soviet army invaded Afghanistan. Then-candidate Ronald Reagan criticized the embargo as counterproductive. As president, Reagan did not lift the ban until April 1981.

But more recently, with American warehouses overflowing with surplus grain and the U.S. farm economy sputtering through a recession and slumping exports, the administration came under intense pressure from grain-state legislators and farm groups to reestablish the long-term guaranteed sale program with the Soviets.

Block, a vigorous lobbyist in the administration's inner councils for renegotiation of the long-term agreement, said yesterday that he was "very pleased that we were able to reach agreement and maintain our agricultural trading relationship with the Soviet Union."

"This will result in increased exports and assurance the U.S.S.R. will continue being a major purchaser of grain grown by U.S. farmers," Block said.

The new agreement also will allow the Soviets to purchase an additional 3 million tons of wheat or corn from U.S. producers without consultations with the Department of Agriculture. The current pact, which took effect in 1976, allows the purchase of an additional 2 million tons.

Although recent reports indicate that the Soviet Union is counting on a bumper grain harvest this year, in contrast to four straight below-par years, the new agreement could go a long way toward reestablishing the United States as a major source of its imports.

At the time of the Carter embargo, U.S. farmers held close to 70 percent of the Soviet market. That figure dropped to about 20 percent as Moscow found new sources in Canada, Australia, Argentina and the European Economic Community. The new pact, by some estimates, could push the U.S. share of the Soviet market to 40 percent or higher.

Moynihan notwithstanding, the new agreement was quickly applauded by farm-belt members of Congress. Sen. Robert J. Dole (R-Kan.), who has hectored the White House for a new agreement and has flown to Moscow to talk trade with the Soviets, was nearly ecstatic.

Dole called the agreement "the end of a long quest to restore the unquestioned reliability of the United States as a supplier of agricultural exports to the world market."

He added, "The appreciable increase . . . in guaranteed annual sales reflects recognition by the Soviet Union that the United States is and will remain a principal source for meeting its agricultural import needs."

An added wrinkle in the new agreement provides that up to 1 million tons of the minimum tonnage could be satisfied by Soviet purchases of 500,000 tons of soybeans or soybean meal. If that option is exercised, the wheat and corn minimum for that year will be 8 million tons, Block said.