WEST BERLIN (AP) _ Soviet objections to NATO membership for a united Germany remain a major obstacle to reunification despite optimism in both East and West Germany that they soon will be one again.

President Mikhail S. Gorbachev of the Soviet Union has said Germany cannot be part of the ''structure of NATO'' and unification should lead to neutrality or even demilitarization.

Chancellor Helmut Kohl of West Germany wants to keep a united Germany in the alliance, and the United States is intent on it.

As a compromise, Foreign Minister Hans-Dietrich Genscher of West Germany has proposed keeping NATO and Warsaw Pact troops out of what is now East Germany.

The United States now has 255,000 soldiers in West Germany and the Soviet Union has more than 380,000 in East Germany. On Tuesday, they agreed to reduce their troops in Central Europe to 195,000 each.

NATO membership is an important issue for West Germans, whose nation is among the world's richest after four decades of protection by the Western alliance.

A look across the crumbling Berlin Wall at the grime-covered, ill-kept buildings of East Berlin is enough to convince most people NATO membership has its advantages.

''For the Federal Republic of Germany, I see little change in the NATO position,'' says Josef Janning, an East-West specialist at the University of Mainz.

He said West Germany's leaders would insist on retaining NATO membership, but the issue is complicated and Janning told The Associated Press he feels demilitarizing East Germany is the most practical solution.

Janning said demilitarized status could end when Europe worked out its security arrangements. ''If there are no crises in Eastern Europe and there is no coup in the Soviet Union, that could happen as early as this decade,'' he said.

That would lead to a radical realignment of the North Atlantic Treaty Organization, turning its attention to Atlantic rather than land defenses, Janning said.

He added that the United States would be a smaller military presence and the rest of its missiles would be removed, but he predicted nuclear weapons would remain in Europe because its security arrangements would include them.

The Soviet Union, which lost more than 20 million people in World War II, wants a single Germany demilitarized so ''it can be of no threat to others,'' Soviet Foreign Ministry adviser Vitaly Churkin said Monday at an East-West conference in Ottawa.

Foreign Secretary Douglas Hurd of Britain said Tuesday few countries in Ottawa except the Soviets suggested a neutral Germany.

Soviet officials also have spoken of abolishing NATO and the Warsaw Pact altogther, but the comments were greeted skeptically in Washington and Western Europe.

East Germany's caretaker government also insists on neutrality, and the new administration to be chosen in free elections next month is expected to oppose full NATO membership.

In a poll conducted last week, 92 percent of the 1,429 East Germans surveyed favored neutrality. It was conducted by the Wickert Institute of West Germany for Quick magazine, based in Munich.

West Germany's opposition Social Democrats have said cutting the size of West Germany's armed forces might resolve the issue.

Defense spokesman Andreas von Buelow said: ''The Soviets will prove cooperative if they can be sure the German side cannot mount an offensive war and if no threats to borders come from there.''

The Social Democrats have a large following in East Germany.