The Soviet Union yesterday accepted President Reagan's offer of a one-year extension of its agreement to buy grain from the United States, making possible what Agriculture Secretary John R. Block said would be a "rebuilding" of the diminished American share of the Soviet grain market.

The Soviet acceptance was delivered in a written message to the U.S. Embassy in Moscow. It will be the second extension of the five-year grain sale agreement first negotiated in 1975. That agreement was interrupted partially by President Carter's Jan. 4, 1980, grain embargo in response to the Soviet invasion of Afghanistan.

Reagan campaigned against the Carter embargo and lifted it in April, 1981, but his decision on renewing the long-term agreement was complicated by the declaration of martial law in Poland last December.

While taking a hard line against the Soviets for the Poland crackdown, the Reagan administration has riled European allies by attempting to block the sale of U.S. technology and parts for a planned Soviet natural gas pipeline to western Europe -- at the same time it has sought to increase American grain trade with Moscow.

But the president has denied that these actions are inconsistent because the grain sales will cost the Soviets scarce hard currency, while the pipeline will eventually bring Moscow money from the West.

Reagan administration officials also have said that American pipeline technology can't be obtained easily on the world market while the Soviet Union can -- and has--found alternative grain suppliers.

Reagan promised American farmers in a Des Moines speech earlier this month that they can expect "record" grain sales to the Soviets next year as a result of his July 30 decision to extend the agreement another year.

Block, who had lobbied hard within the administration for another one-year extension, said yesterday that the Soviet acceptance "will allow America's farmers to continue rebuilding this important market, which was thrown away to our competitors during the partial embargo imposed on U.S. agricultural sales to the Soviet Union in January, 1980."

The current agreement obligates the Soviets to buy 6 million metric tons of grain annually, and allows them to purchase up to 8 million additional tons without permission from the United States. During the current year, the United States has offered an additional 15 million tons, Block said.

So far this year the Soviets have purchased only 13.9 million tons, almost exclusively corn and wheat, according to Agriculture Department records. The current one-year agreement expires Sept. 30, and government officials said they were uncertain how much grain the Soviets would buy in the weeks remaining in this year's agreement.

Last fall the Soviets were given clearance to buy a total of 23 million metric tons in the 1981-82 year, although actual sales have fallen below that amount. Poor harvests in recent years have forced the Soviets into the world market for record grain purchases.

Overall, the Soviets are expected to buy about 46 million tons from all sources this year, meaning that the U.S. share is only about 30 percent, the officials said. That compares with a 90 percent share in 1978-79, the officials added. The result of the Carter embargo was to turn the Soviets toward alternative grain sources in Canada, Argentina and Australia, they said.

"The willingness of the Soviet Union to accept this extension is proof that they believe the president's pledge that the U.S. will again be a reliable supplier," Block said in a statement. "In keeping with the president's wishes, I will be contacting the Soviet Union immediately to determine a date for discussing additional grain sales during this second extension."

Farm groups have expressed approval of Reagan's decision to extend the agreement another year, but have criticized the administration for not going far enough in reaching a new long-term pact.