A Swedish official commission today accused the Soviet Union of operating six submarines inside Sweden's coastal waters last October, which the government charged was part of a pattern of "gross violations" of Sweden's territory by the Soviets.

Sweden recalled its ambassador from Moscow as a mark of disapproval and Prime Minister Olof Palme later called in the Soviet envoy in Stockholm for a verbal protest. The Kremlin actions, Palme told the Soviet official, represent a "grave breach of international law."

The commission was appointed last fall after a fruitless three-week search by the Swedish Navy for suspected intruders in waters near Musko Naval Base, the country's most sensitive naval installation.

The study, issued in Stockholm, concluded that six submarines--including three manned midgets with a "bottom-crawling capacity of a hitherto unknown character"--did penetrate to near the Swedish coast in October. It said that three of the submarines evaded a massive hunt in the Horsfjarden bay where the base is located and the other three remained in the archipelago just beyond.

In part, the report attributed the successful escapes of the submarines to their advanced tracking systems. The imprints left by these were photographed by Swedish divers and displayed today. One midget left what appeared to be tractor-type tracks indicating that it maneuvered along the sea floor. The second midget left more conventional marks of propellers and a keel.

The Soviet submarine problem represents a major security headache for Sweden's neutralist governments. Since one of Moscow's submarines went aground near another major Swedish base in 1981, the issue has become an increasingly important element in the country's foreign policy. Despite a substantial upgrading of Sweden's antisubmarine defenses, the commission, made up of military and civilian experts, found that more needed to be done.

"It is essential that both alliances the North Atlantic Treaty Organization and the Warsaw Pact have confidence in Sweden's resolve and ability to guarantee both in peacetime and in war that no foreign power will be allowed to take advantage of Swedish territory," the commission declared.

Sweden has the longest coastline of the countries facing the Soviet Union on the Baltic and it takes on East-West strategic importance because it dominates the sea lanes connecting the Baltic, where the Soviets keep a major fleet, and the North Sea and Atlantic Ocean.

By recalling Sweden's ambassador to Moscow, Carl De Geer, and summoning the Soviet envoy in Stockholm, Boris Pankin, to receive a stiff protest, Palme has gone further than previous Swedish leaders in showing official displeasure over the submarines. Swedes worry that the purpose of the Soviet activity is to show the country's vulnerability to a landing from the sea in time of war.

The report, delivered today to the Swedish Defense Ministry and also made available here, said that at least 40 incidents of submarine intrusions had been noted in 1982, a considerable increase over previous years, and these were marked by increasingly "provocative behavior."

Such incidents continue, diplomatic sources said, with suspected sightings just last weekend.

The October events received worldwide attention largely because the Swedes predicted--wrongly as it turned out--that they would be able to force the intruder to surface by using depth charges.

One of the midget submarines apparently broke out of the attempted trap several days later, leaving a second midget, described as a "tracked underwater vehicle," which remained somewhat longer, according to the study.

At the time, Sweden speculated that the submarines were Soviet. Today, citing "evidence in abundance--technical and circumstantial," the commission said that the initial judgment had been confirmed. The Soviets, said the report, keep about 45 submarines in the Baltic and Poland keeps four. It dismissed suggestions that any of the intrusions were by NATO submarines.

The commission urged the spending of $30 million for the purchase of four antisubmarine helicopters, among other things.

It disputed suggestions that the government let the intruders escape to avoid an international incident. The commission said more depth charges were used during the search than in any Swedish military operation since World War II.