Foreign ministers of the Soviet-led Warsaw Pact reaffirmed their interest in detente today but avoided mention of the Soviet occupation of Afghanistan or unrest in Poland, both of which have complicated East-West relations.

Ending a two-day conference here, the ministers reiterated their desire to go ahead with the 35-nation East-West meeting in Madrid next month to review the 1975 Helsinki Accord on European detente. The Madrid meeting will deal largely with human rights and cooperation among Western and Eastern nations.

While American officials are expected to press for more progress on human rights, Communist representatives are likely to emphasize the need for more cooperation and negotiation, particularly on military matters. The Warsaw Pact ministers today noted, in particular, their hope that a special conference on European disarmament could be agreed on in Madrid.

Although no reference was made in the final communique to the still unsettled situation in Poland, the matter is known to be of serious concern to Poland's Socialist allies. It is widely assumed here that the issue was at least touched on at the pact meeting.

The Warsaw government's concession to allow formation of free trade unions is unprecedented in the Communist bloc and officials in neighboring countries are believed to fear possbile spillover effects.

It was merely coincidental, Polish authorities said, that the Pact meeting, one of two each year, occurred in Warsaw this time. The absence of any public mention of recent events here -- which marked the gravest crisis in East Europe in a decade -- seemed intended to take the focus off Poland.

The meeting was attended by Soviet Foreign Minister Andrei Gromyko, the highest-ranking Soviet official to visit Warsaw publicly since the Polish strike settlement in August. The ministers met today with Polish party chief Stanislaw Kania, but no details of what was said were released.

The Warsaw Pact is a military alliance that includes the Soviet Union plus six East European countries: Bulgaria, Czechoslovakia, Romania, Hungary, East Germany and Poland.

While Polish authorities appear resigned to working with their new unions, accepting them as an authentic mass worker movement, other East European governments continue to take a harder line against the existence of independent power groups.

Such disquiet, for instnace, appeared to Western observers to be behind East Germany's sudden decision recently to raise currency exchange requirements for Western visitors, a move that effectively will reduce the amount of Western traffic into East Germany. The action drew an especially hostile reaction from West Germany, which labeled it a blow to detente.

In general, both the Eastern and Western alliances seem to be taking the current cooling in relations as a time for inner consolidation and affirmations of unity. One of Warsaw's leading papers, Zycie Warszawy, today for instance voiced solidarity with East Berlin and attacked Bonn for its sharp reaction, saying the West German counterattack testified to a lack of political tact and showed the federal republic's shortcomings.

"In today's world situation, political imagination compels one to cautious wording," the paper said. "By addressing East Germany with threats of a comeback to cold war, Bonn has rather displayed the lack of it."

Poland itself would seem to have a keen interest in saving detente, since any further deterioration of the East-West climate could imperil Warsaw's own maneuvering room within its alliance in dealing with a still delicate political situation at home.

But Warsaw authorities have not been shy about firing some shots of their own at the West. The Polish press agency, PAP, reported over the weekend that the Polish Foreign Ministry had summoned diplomats from the United States, West Germany and Britian to object to certain actions by political parties and trade organizations in these countries, a reference to aid and assistance offered by these groups to Poland's new independent unions. a

Polish officials view such aid as an interference in the country's internal affairs. They also complained to the foreign embassies about Western news coverage, citing especially some radio stations, according to PAP.