Andrei Sakharov and his wife, Yelena, barely flinched when the flashbulbs exploded as they stepped into a dank Moscow courtyard after a dinner one night last fall. The intruders, who sped away in a black sedan, were KGB security police - a fact of life for the famed dissident Nobel Prize-winner.

But another guest watching the scene from a window, was stunned. He was Robert L. Bernstein, president of Random House, which publishes Sakharov's writings in the United States.

Bernstein was in Moscow in a delegation of prominent publishing executives interested in expanding trade with senior Russian officials and at lavish banquets and receptions made more of an impression on him than those few seconds in the courtyard.

"It is a horror that a Nobel Prize-winner can't go to a dinner without KGB harassment," he remarked sadly. "It absolutely baffles American publishers that citizens, many of whom happen to be writers, are abused in this way."

The incident is relevant now because it sums up what seems to happen so often in U.S.-Soviet relations: a sincere effort to bridge the many enormous gaps between the systems collapses because Americans are repelled by the harsh way the Kremlin deals with anyone critical of it.

President Carter's grand design for breaking the deadlock in superpower relations and avoiding a new spiral of hostility begins with strategic arms agreements that all involved regard as essential. But that plan is already endangered because Washington cannot overlook what is turning into the toughest Soviet crackdown on dissidents in several years.

Instead of the grace period that had been expected for the new administration, Kremlin actions - a warning to Sakharov, the arrest of dissidents Alexander Ginzburg and Yuri Orlov, the expulsion of Associated Press reporter George Krimsky - have forced the president to speak out, to prove that his declared commitment to human rights is geniune.

Now the Soviets are warning that such American declarations can have an overall negative influence on the course of relations. While Carter and Secretary of State Cyrus R. Vance have said the "linkage" between issues should be avoided, the Soviet Communist Party newspaper Pravda - in a lengthly editorial today clearly intended as the authoritative Kremlin view - stated:

"The relaxation of tensions presuppose mutual respect for sovereignty, laws and customs of states, while the adversaries of detente try to interfer in the internal affairs of socialist countries. This is shown, for instance, by the recent act of the U.S. State Department, which manifested touching "concern" for dissidents in the U.S.S.R. and Czechoslayakia."

Because of American belief in the importance of individual rights and freedom of expression, the fate of a handful of Russians - whom relatively few people in the United States could probably name - suddenly looms as a major issue between the tow powers. It is not the first time.

Although the Soviets belittle the dissidents, calling them, as Pravda did today, "renegades who do not represent anyone." Moscow seems incapable of subordinating the need to intimidate internal critics to a broader objective of improving relations with the United States.

Thus the Soviet-American mood again turn sour.

The mystery is why the Soviets encouraged this new situation to develop - since it was the Soviets, after all, who called Sakharov in to warn him that he faced criminal action after a statement that might easily have ignored. When the State Department expressed dismay, the Soviets angrily complained and the action-reaction cycle had begun.

Judging from today's Pravda, the Kremlin has much more than Mr. Carter on its mind. The article portrays the "unprecedented hullabaloo" in the West in support of the disparate human-rights movements that have been active recently in Eastern Europe as part of a broader effort "to discredit socialism, to weaken the positions of the socialist countries since the forces of reaction fear the powerful advances of those countries."

President Carter's first lesson from the Soviets seems to be - as it has been for so many Americans before him - that protecting the ideology on which the Soviet state justifies itself is a matter of the utmost importance to the Kremlin. U.S. support for Sakharov and other dissidents, expressed in any form, strikes at the heart of that ideology.