A Soviet submarine that ran aground 10 days ago in a restricted military zone on the southern coast of Sweden is almost certainly carrying nuclear weapons, the Swedish government charged today.

In a strongly worded protest note handed to the Soviet ambassador here, the government said that after an investigation it had concluded "with dismay and indignation" that the submarine "probably has one or more nuclear weapons aboard."

Nevertheless, Swedish officials said the submarine would be turned back to the Soviet Navy as soon as weather permitted on Friday. The Associated Press said it was towed by the Swedish Navy early Friday into the Baltic, according to Swedish Navy officials. A flotilla of Soviet warships has been waiting in international waters since the sub was discovered stranded on submerged rocks Oct. 28.

The submarine's captain refused to allow Swedish military investigators to inspect its torpedo bays. But Swedish officials said evidence, including radiation scans of the submarine's exposed hull while it was stranded on submerged rocks, unmistakably indicated the presence of nuclear weapons.

After the Soviets "ignored the request of the Swedish government for clarification of this point" in secret exchanges here earlier this week, according to the protest note, "the Swedish government must interpret this as implying that the Soviet government has been unable to deny the presence of nuclear weapons on board the submarine."

Dismissing Soviet claims that "faulty navigation" caused the submarine to stray into a narrow, rocky channel of shallow water among offshore islands near several sensitive Swedish military installations, the Swedish government said it also had concluded that "the Soviet submarine intentionally violated Swedish territory for the purpose of carrying on illegal activities."

Swedish officials said they could only speculate whether those activities included spying or testing Sweden's defenses. The protest note said the government "finds this flagrant violation of Swedish territory all the more remarkable and serious since in all probability the submarine has carried nuclear weapons into Swedish territory."

Swedish Foreign Minister Ola Ullsten said no action was taken against the submarine's captain and crew, who were questioned over several days by the Swedish military investigators, because "they have not created any personal affront." Military sources revealed yesterday the presence on the sub of a high-ranking Soviet officer, senior to the craft's captain. No further details on his presence were made available today.

Ullsten said the Swedish government had chosen to deal "politically" with Moscow by making strong diplomatic protests and by publicly revealing that the submarine is carrying nuclear weapons.

Ullsten said "it must be very embarrassing" for this to be made known at a time when the Soviets "have created the impression that they are more in favor than the United States" of nuclear disarmament generally and establishment of a nuclear-free zone in Scandinavia in particular.

Sweden, a staunchly nonaligned nation with no nuclear weapons, has been a leading advocate of international nuclear disarmament. Soviet President Leonid Brezhnev has offered to guarantee not to use nuclear weapons against Sweden, Finland or NATO members Norway and Denmark if they join in a Nordic nuclear-free zone.

"This will affect Swedish attitudes toward Nordic nuclear free-zone proposals from the Soviet Union," said one senior Swedish diplomat. "We have caught the Soviets with their fingers in the cookie jar."

Swedish officials and journalists said government and newspaper switchboards have been jammed by callers demanding that tough action be taken against the Soviets and the submarine's captain and crew. In recent years, the Swedish military has reported frequent incursions in Swedish waters by what were believed to be Soviet or Polish submarines from the Warsaw Pact's Baltic Sea fleet. But the Swedish public was often skeptical of these reports, government officials said, sometimes calling them "budget boats" that seemed to appear whenever the military wanted more money. Until last week's grounding of what is officially identified as Soviet Submarine 137, there has never been incontrovertible proof of such an incursion.

Swedish officials said the Soviets also have been embarrassed by having international attention focused on this military violation of the neutrality of a leading nonaligned country. Swedish Prime Minister Thorbjorn Falldin today called it "the most grave intrusion into Swedish territory since World War II."

Swedish officials pointed out that the submarine, although now able to move under its own power, would be towed slowly to sea for its return to the Soviets while being televised and photographed in specially arranged press boats and charter planes. This is expected to be the final act of a sometimes tense, sometimes comic military and diplomatic drama that began Oct. 27, when Soviet Submarine 137 ran aground in the fog in the Karlskrona Archipelago just off the Swedish coast, about 250 miles south of Stockholm.

It is a 228-foot, Whiskey-class sub believed to have a crew of 56. It was making its way among rocks and islands near Sweden's Karlskrona Naval Base and secret coastal artillery emplacements in waters from which foreigners are prohibited. "You have to know exactly where you're going to get in -- and out," one source said.

Sources here acknowledge that there are also tunnels under the rocks and islands for use by Swedish submarines.

Swedish officials also said tests were conducted in the area last Tuesday for a new antisubmarine torpedo that could be used by Swedish helicopters, submarines or surface ships.

The Soviet submarine went undetected by radar and other coastal surveillance, officials said, because they could not now cover the entire Swedish coastline. The submarine was discovered stranded on the rocks by a Swedish fishing boat.

The Swedish government refused immediate Soviet demands that its naval vessels be allowed to rescue the submarine. While a changing number of Soviet ships, including two destroyers, massed just outside Sweden's 12-mile territorial water limit, the Swedish Navy surrounded the sub with its own ships. Swedish marines in battle gear were landed on nearby islands. Press boats were allowed to encircle the submarine.

In prolonged and sometimes acrimonious negotiations that included 10 meetings here between Ullsten and Soviet Ambassador Mikhail Jakovlev, the Swedish government demanded and received a Soviet apology and a Soviet promise to pay Swedish expenses for rescuing and refloating the sub.

The Soviets also agreed to the interrogation of the captain and crew. But Swedish military investigators were not allowed to inspect the inside of the submarine beyond the central quarters.

But while the submarine was aground, with one side of its hull completely out of the water, Swedish investigators in a small boat closely scanned it during several nights with radiation detection devices. They showed, according to the Swedish government, "that it is practically certain that Uranium 238 is present on board" the conventionally powered submarine where other information had indicated torpedoes with nuclear warheads might be located.

A Swedish diplomatic source abroad indicated that "seaworthiness tests" on the outer hull of the Soviet sub, lightly damaged in the grounding incident, were another source of information. This source added that U238 was located in the front part of the vessel, where torpedoes are situated on Whiskey-class subs.

Sweden's supreme military commander, Gen. Lennart Ljung, said today that the U238 could have been used as a protective shield around U235, a principal ingredient in nuclear arms.

While keeping this information from the public, Swedish officials informed the Soviets earlier this week and asked to be allowed to inspect the submarine's torpedoes. The Soviets answered, Ullsten said today, that the submarine carries "the necessary weapons and ammunition" but that "this has nothing to do with the circumstances surrounding the unintentional intrusion by the submarine into Sweden's territorial waters."

"It is clear that they had someting to hide," Ullsten said today. Picture 1, Swedish truck delivers water to Soviet submarine refloated after going aground in area of Karlskrona Naval Base.(AP) Picture 2, Senior Soviet naval officer, identified only as Avtsukiewiech on Sub 137. AtSwedish Commander Karl Anderson, with translator at center. AP