VLADIVOSTOK, U.S.S.R. (AP) _ Vladivostok will lift a 40-year veil of secrecy Jan. 1 with grandiose dreams of becoming another San Francisco and living up to its name, ''Ruler of the East.''

The Soviet military, whose gray warships dominate the spectacular Pacific harbor, has finally agreed to open the city to foreigners.

Vladivostok already has the welcome mat out for potential investors. Seedy hotel lobbies bustle with businessmen from Japan, the United States, South Korea, China and Taiwan.

Toyota has opened a service center for the many Japanese cars that dodge through the potholed streets. Dozens of people line up outside the first Soviet-American boutique for track suits and blue jeans. Americans are completing a feed-grain agreement to help alleviate the meat shortage.

''Vladivostok should be a world-class port, the meeting point of East and West and Japan,'' said Valery Lozovoy, vice chairman of the regional government's executive committee.

In the late 1950s, Soviet leader Nikita Khrushchev dreamed of turning Vladivostok into another San Francisco. There wasn't enough money, however, and the military balked at exposing its Pacific headquarters to prying foreign eyes.

The end of the Cold War may have changed the political climate, but it didn't melt the local brass: They vetoed an initial attempt to open the city last spring, on security grounds.

Now President Boris Yeltsin of the Russian republic has gone ahead, with a decree in September that Vladivostok will be opened to foreigners, their businesses and ships when the new year begins.

For Vladimir Kuznetsov, a 36-year-old economist Yeltsin chose in October to head the regional government, opening the city is a dream come true.

''It is my aim to make Vladivostok a business and commercial center not only of the region, but of the eastern part of Russia, in 10 years,'' Kuznetsov, who saw the city first as a navy sailor, said in an interview.

''The headquarters of the Pacific Fleet will remain here and ships will remain here, but I am sure it will cease to become a military fortress.''

Rear Adm. Igor Chmelnov, commander of a naval group, said the fleet ''will do its best and not stand in the way.''

Sensitive military communications and security operations are being moved out, but Chmelnov said some problems remain. Dmitry Grigorovich, vice chairman of the regional legislature, said the move will take time because of the cost.

Vladivostok is the closest Soviet port to Australia, a two-week journey from the United States and only 425 miles from Japan.

That bodes well for trade, but not even optimists like Kuznetsov expect quick results. The dire economic situation across the country has made investors exceedingly cautious.

''We have a very weak infrastructure,'' Grigorovich said. ''We need hotels, communications and transport.''

Vldimir Shkrabov, editor of Red Banner, the largest-circulation newspaper, said the military-industrial complex still controls virtually all factories, unlike the situation in other regions.

While plants elsewhere are being converted to produce consumer goods, he said, no one knows whether that can be done in Vladivostok.

Still, there is the vision of San Francisco: the hills, trolleys and harbor views so like those of Vladivostok.

Leninskaya Street, the main thoroughfare, has a certain charm. Its architecture ranges from Gothic and German baroque to modern and turn-of-the- century Russian. Groups of pink-cheeked young sailors are everywhere, trailing black ribbons on their white sailor hats.

But signs of hard times abound.

The city's hills are blanketed with monotonous, dilapidated high-rise apartments. Golden Horn Bay, magnificent from afar, is polluted.

Sidewalks are broken. When it rains, rivers of water rush down streets because of poor drainage, leaving seas of mud. Long lines curl out of near- empty food shops, where staples are rationed.

Some residents worry that opening the city will increase the already-high crime level. Alexei Shirkov, a 67-year-old retired sailor who helped ferry U.S. frigates and minesweepers from Alaska during World War II, responded: ''The foreigners won't rob us.''

For many, an open city means progress.

''I hope when Vladivostok is opened there will be less mud in the streets,'' said Yelena Lipchenko, a construction engineer. ''I hope to get an interesting job in some joint venture.''

''Perhaps if a lot of foreigners come here, it will push us to reach their level,'' said Leonid Ivanov, 54, an electrical worker. ''It will make us more disciplined and make us work harder, because the Soviet people have grown lazy.''