Soviet Politburo member Mikhail Gorbachev and British Prime Minister Margaret Thatcher, in lengthy private meetings here today, "both expressed a clear interest in avoiding an arms race in space," authoritative British sources said tonight.

"They are concerned, quite clearly as we are," one source said, in preventing the arms race from spreading to space, adding that Thatcher "undoubtedly" will raise the space issue with President Reagan when she meets with him at Camp David on Saturday.

The British sources, who briefed reporters but asked not to be identified, said the visiting Soviet official and the Conservative British leader discussed, "though not in any detail," the Reagan administration's Strategic Defense Initiative -- so-called "Star Wars" research into space-based defense against Soviet missile attack.

But the sources stressed that Thatcher is "a loyal ally" of Reagan, and they declined to answer specific questions about whether Thatcher would press Reagan to cut back on the project.

The Soviets are anxious to curtail both the Star Wars effort and U.S. testing of antisatellite weapons and were expected to emphasize these views to Thatcher, the allied leader closest to Reagan.

While Thatcher's government is known to support the United States' at least having a balance of antisatellite weaponry to match what Moscow already has, Thatcher has made two speeches this year in which she has come out against the dangers and the costs of a space race. That view also reflects the feeling of the other U.S. allies in Europe. Furthermore, they feel that if the Soviets build an antimissile defense, it could nullify the small, independent deterrent force of French and British nuclear missiles.

With talks set for Jan. 7 and 8 between Secretary of State George P. Shultz and Soviet Foreign Minister Andrei Gromyko in Geneva, one British source said tonight that Gorbachev brought "a personal message" for Thatcher from Soviet President Konstantin Chernenko that set out what Chernenko described as the "positive attitude with which the Soviets approach both Soviet-Anglo relations and international issues, particularly the Geneva talks."

The source said Gorbachev "gave the impression they want to make progress" at Geneva and that they want to approach those talks "in a positive and constructive way."

Gorbachev, 53, the highest ranking Soviet official to visit Britain in eight years and the man widely viewed as second in command in Moscow and a possible future president, spent 5 1/2 hours at Thatcher's country retreat at Chequers, much longer than scheduled.

The meeting presented the first opportunity for a major allied leader to size up Gorbachev face to face. The British sources gave him high marks.

"He's clearly a very impressive man, actually," one source said, "of obvious authority and influence. He was impressively relaxed and seems to have a very good sense of humor. The smile was never far from his face. He knows his way around."

The sources said almost all of the 2 3/4 hours of private discussions was spent on East-West relations and arms control. While this was not a negotiating session, one source said, "one clear outcome was complete agreement that much more contact at this and other levels was needed as a means of building confidence necessary for success in arms control negotiations."

The source said Gorbachev "conveyed the impression that if the U.K. and the U.S.S.R. established better relations, then the effect would spread," an apparent reference to British influence with the United States.

Thatcher, according to British sources, "sought to impress" Gorbachev with the sincerity of the allied and American approach to achieving security and arms control and a lower level of armaments, which holds that a balance of power is essential, as is an ability to verify that balance.

As for Gorbachev's view, one British source said, "They want to feel secure but with far fewer weapons if they can possibly get it. They see the opportunity, just as we do, for spending the money that goes into arms on raising the standard of living of their people."

That comment is potentially significant since Gorbachev is widely viewed as supporting domestic economic reforms in the Soviet Union.

The source said under questioning that Thatcher did not hear anything new about the Soviet arms negotiating position but that "what we did get out of it is a better understanding of their point of view."

On other points, the source said Thatcher told Gorbachev that the Soviet occupation of Afghanistan is "not helpful" in improving East-West relations, and that she also raised the issue of treatment of various Soviet dissidents, including physicist Andrei Sakharov.