At a time when East-West relations have been shaken by the invasion of Afghanistan and turmoil in Poland, the United States and the Soviet Union are about to bump heads in a forum that was intended to advance detente.

The occasion will be a Madrid meeting to review events in the aftermath or the Conference on Security and Cooperation in Europe, which brought leaders of 53 nations to Helsinki for a 1975 summit.

The Helsinki meeting produced a document known as "the final act" to serve as blueprint for improved relations between Western and Eastern Europe.

But, as representatives of the participating countries prepare to gather in Madrid five years after Helsinki, their follow-up conference seems certain to become a series of confrontations underscoring the great differences in how East and West define terms like "detente."

This conflict is expected to become immediately apparent both in the preparatory talks, which get under way Sept. 9, and in the fromal conference scheduled to begin Nov. 11.

With very little to cite in the way of accomplishment over the past five years, the two stages of the Madrid meeting seem distined to pit East and West striving to score propaganda points and jockeying for long-range position.

That the Helsinki final act has done little to bridge the gap between the values of East and West already was clear at the first follow-up conference in Belgrade in 1977-78. In Madrid this year, the Afghanistan and Poland turmoils can only make the conflicts exposed in Belgrade more pronounced.

Even back in the early 1970s when both sides regarded CSCE as a potentially important instrument for nurturing the infant stirrings of detente, there were very sharp differences in what each hoped to gain.

For the Soviet Union, the Helsinki final act's language on the inviolability" of existing European borders, subscribed to by 33 European nations and the United States and Canada, put the stamp of international legitimacy on its World War II territorial acquistions and cerfified the West's acceptance of the Soviet-controlled government in East Germany.

In exchange for conceding these points, the West sought to liberalize the human rights situation in Eastern Europe through the final act's emphasis on "free exchange of people, information and ideas."

For the United States, that goal has become even more important since President Carter came into office with his strong commitment to human rights. In fact, at the Belgrade meeting, Arthur Goldberg, who headed the U.S. delegation, pushed the question of human rights in Eastern Europe so strongly that he came under fire from America's West European allies as being counter-productive.

Although the Soviets prevented the final declaration in Belgrade from even mentioning "human rights," the United States is determined to make it one of the two main issues at Madrid. This time around, because of Afghanistan and the East European stirrings exposed by the Polish situation, U.S. officials are hopeful of more West European support than was evident in Belgrade.

Specifically, the United States Plans to use Madrid as a forum for charging that the Soviet invasion of Afghanistan marked a wholesale violation of the principles embodied in the Helsinki accord, and will urge that the meeting call the Soviets to account.

In a companion move, the United States also wants to underscore Moscow's continuing policy of suppressing dissent within the Soviet Union and other East European countries. The aim: to put the Soviet leadership on the defensive by exposing its human-rights record to international scrutiny and force Moscow into some concessionary easing of the reins.

But the Soviets, determined to ride out the storm over Afghanistan and obviously concerned about what events in Poland portend for Moscow's hegemony over Eastern Europe, are expected to resist even more fiercely than they did in Belgrade.

Since the conference operates according to a "conference rule" requiring all 35 participants to acquiesce in all decisions, the Soviets again will be able to block any formal action on human rights. But they won't be able to stop the United States and other like-minded Western governments from talking at length and making other moves to single out Moscow's human rights record for world-wide attention.

The other subject expected to play a major role at Madrid involves a call by Moscow and its Warsaw Pact Allies for a post-Madrid conference on military detente and disarmament covering the two big military blocs in Europe. Complicating this situation is the fact that France, maverick of the North Atlantic Treaty Organization, also is pushing a similar proposal. t

U.S. officials are openly hostile to the Soviet call, which they regard as a ploy to strengthen the Warsaw Pact at NATO's expense. Among other things, the Soviet plan would bar in creasing membership of the two military alliances, a move that would prevent-Spain from joining NATO.

But, while U.S. strategy aims at out right defeat of the communist bloc's move, the need to get along with France, which has the backing of the European Economic Community, could force the United States to accept some kind of military conference in the aftermath of Madrid.

As of now, U.S. officials will say only that they are looking at the French proposal with "an open mind." But they add, if the momentum of the Madrid conference does move in the direction of military negotiations, the United States will insist that it involve only conventional forces, that it not undercut other initatives like the on-going talks on force reductions in Central Europe, and that it emphasize so-called "confidence-building measures" such as prior notification by each side of troop movements and maneuvers and limited inspection of each other's facilities.