Soviet leader Mikhail Gorbachev, speaking after Moscow and its six East European allies formally agreed here today to extend the Warsaw Pact military alliance for another 20 to 30 years, revealed an apparently new offer on strategic missile cuts if the United States abandons its "Star Wars" space defense plans.

In remarks reported by the Soviet news agency Tass, Gorbachev told his allies at the Soviet Bloc summit meeting that "we already have suggested in the Geneva arms talks that both sides reduce strategic offensive arms by one-fourth as an opening move.

"But we would have no objections to making even deeper mutual cuts. All this is possible if the arms race does not begin in space, if outer space remains an area of peace," Gorbachev said, according to Tass.

In the previous Geneva talks that ended late in 1983 when the Soviets walked out, Moscow had offered a 20 percent reduction, from 2,250 Soviet missiles and heavy bombers to 1,800. The current offer indicates that Moscow is willing to extend that to at least 25 percent and possibly beyond.

Speaking after a gala ceremony marking the first formal renewal of the 30-year-old alliance, Gorbachev said the Warsaw Pact was ready for East-West peace and cooperation. But he said an intensive buildup by the West of nuclear and conventional forces compelled a further strengthening of the alliance.

In a warning addressed to Washington, the Soviet leader proclaimed: "If preparations for Star Wars continue, we will have no other choice but to undertake countermeasures, obviously including intensification and improvement of offensive nuclear armaments."

"The development for Star Wars is just beginning," Gorbachev said. "But it is already making the present-day world develop a fever and leading to the destabilization of the entire system of international relations, to even sharper political and military confrontation.

"This should not be forgotten both by the initiators of the above provocative undertaking and by those who are being invited to share in it," he added, addressing NATO nations that are considering joining the U.S. research effort.

Gorbachev urged the United States to reconsider its rejection of a mutual U.S.-Soviet freeze on nuclear weapons, denying American claims that such a move would consolidate a Soviet edge.

"Who said we want to stop at the freeze?" he asked. "Contrary to that, we would like to see it followed by a rapid reduction of nuclear armaments."

The Soviet chief called on the Reagan administration to give "more serious and thorough" thought to the announcement April 7 of a Soviet freeze on the deployment of intermediate-range nuclear missiles and asked America to "display restraint" in stationing new U.S. nuclear missiles in Western Europe. Those missiles are meant to offset the much larger numbers of new Soviet medium-range missiles already deployed.

The extension of the Soviet-led Warsaw Pact military organization, whose charter had been due to expire next month, was accomplished in a relatively brief but star-spangled meeting at Warsaw's Palace of the Council of Ministers, a neoclassical structure used mostly for formal occasions. In the same chandeliered room in which the Warsaw Treaty was signed 30 years ago, Gorbachev gathered around an enormous rectangular table with the heads of the communist parties and governments of Poland, Hungary, Czechoslovakia, Bulgaria, Romania and East Germany.

There was no reported change in the text of the treaty, which commits member states to come to one another's defense. The 20-plus-10-year extension formula that was adopted simply repeated the treaty's original terms.

Several East European states -- among them, Romania, Hungary and East Germany -- reportedly had wanted a shorter renewal period of 5, 10 or 15 years. While their efforts failed, today's session avoided discussion of basic Warsaw Pact policy questions, over which other differences have existed between the Soviet Union and its allies. These issues were deferred until a meeting of the Warsaw Pact leaders now scheduled for the autumn in Sofia, Bulgaria.

Such a political summit had been planned for mid-January in Sofia but was postponed due to the illness of the late Soviet leader Konstantin Chernenko, who died March 10. The autumn session could afford Eastern European states a chance to extract from the newly elected Gorbachev a little more freedom in terms of being consulted on military strategy and budgeting decisions, according to western specialists.

A protocol signed by the Soviet Bloc chiefs called for the Warsaw Treaty to stay valid for another 20 years, and included a provision for another 10-year renewal after that if member states do not move to rescind the agreement.

The protocol was signed by Gorbachev, Todor Zhivkov of Bulgaria, Janos Kadar of Hungary, Erich Honecker of East Germany, Wojciech Jaruzelski of Poland, Nicolae Ceausescu of Romania and Gustav Husak of Czechoslovakia.

A communique issued at the end of the session said the communist leaders had "exchanged views on the current problems of European and world politics." It praised the treaty for strengthening Soviet Bloc cooperation and ensuring security in the region.

The statement said, "Never have we been followers of the division of Europe and the world into opposing military blocs." But it added that so long as a threat from NATO exists, Warsaw Pact members would strengthen their alliance. The communique repeated the pact's standing offer to disband provided NATO also dissolves.

Security was tight in the Polish capital, which has been the scene of antigovernment demonstrations since the suppression of Solidarity, Eastern Europe's first independent trade union, in December 1981.

Main streets and bridges across the Vistula River were closed as the Communist Party leaders and their high-level delegations drove in large black limousines to lay floral wreaths at the tomb of Poland's unknown soldier, at a new monument commemorating those who died in Warsaw during the 1939-45 Nazi occupation of the city and at a Soviet mausoleum commemorating the 600,000 Soviet soldiers who died ridding Poland of German troops during World War II.

The decision to hold the renewal ceremony in Warsaw was regarded by some western diplomats as a mark of Soviet Bloc approval of Jaruzelski's efforts to restore communist authority following the Solidarity upheaval.

Delivering a toast at a banquet after the signing, Jaruzelski sought to assure his allies of Poland's loyalty to the Warsaw Pact.

"It was just our country from which imperialism was going to start the so-called dismantling," he said in a reference to claims that the West tried to manipulate the Solidarity movement to overthrow communist rule in Poland. "It spared no means for it. It did not shrink from applying pressure, boycott, wicked restrictions, abject propaganda and aggression. This is not in the past only. This is still the present day."

Endorsing the renewal of the Warsaw Pact, Jaruzelski, dressed in civilian clothes rather than his customary Army general's uniform, declared: "You do not lay down your shield when the other side takes to the sword. That mistake shall not be made by us."

The Warsaw Pact was formed on May 14, 1955, by eight nations signing the Treaty of Warsaw. Albania, one of the original signatories, ceased to participate in the alliance in 1961 and formally withdrew in 1968. Yugoslavia, which is communist but pursues a foreign policy of nonalignment, is the only other Eastern European country not to belong.

The treaty's original duration was 20 years. It was renewed without fanfare in June 1975 for another 10 years.

Since its inception, the pact has gone through a significant transformation. At first essentially a political instrument used by the Soviet Union to legitimize the presence of its forces in Eastern Europe and respond to the rearming of West Germany and Bonn's entry into NATO in 1955, it has evolved into a military structure through which Eastern European armies are trained and more closely integrated.

Some East European states have pressed for a more equal position in Warsaw Pact military affairs. Spearheading this campaign has been Romania, which refused to participate in the 1968 invasion of Czechoslovakia and says it never will be involved in an attack on another country.