WARSAW, Poland (AP) _ Five Soviet Jews arrested outside a Moscow synagogue during the weekend were freed after the American Jewish Congress intervened on their behalf, the head of the organization said today.

The five were part of a group of Moscow Jews celebrating Simchat Torah, the culmination of the Jewish high holidays, on Saturday. Elie Wiesel, winner of the 1986 Nobel Peace Prize, took part in the ceremonies in Moscow's main synagogue.

The detainees were charged with hooliganism and other offenses, said Henry Siegman, executive director of the American Jewish Congress, who had just arrived in Warsaw after a five-day trip to Moscow with other members of the congress.

It was not immediately clear was prompted the arrests.

Siegman did not give the names of the detainees, but said two of them were refuseniks, Soviet Jews who have been denied permission to emigrate.

He said delegation member Samuel Pisar, a Russian-speaking lawyer, asked a Moscow judge to have the case sent to a police court. The court fined them 50 rubles each and released from custody, Siegman said.

''Mr. Pisar reviewed with the judge the depositions of various witnesses and stressed the interest in this case of the prominent American Jewish leaders with the American Jewish Congress delegation,'' Siegman said.

He said the five detainees were ''incredulous over their unexpected release'' and were greeted outside the police station by ''cheering and singing from refuseniks who had been waiting for hours.''

Simchat Torah is a major event for Soviet Jews who gathered in large numbers Saturday when they learned that Wiesel would attend.

Siegman said congress officials were in Poland as part of a tour that included the Soviet Union and Romania.