JERUSALEM (AP) _ Israeli soldiers clashed with Palestinians today in the occupied Gaza Strip, and at least four Palestinians were killed and dozens were wounded, U.N. officials said.

The violence was the bloodiest confrontation between Palestinians and troops in the occupied lands in three years. Palestinians in the West Bank and Gaza Strip have been waging a revolt against Israel's occupation since December 1987.

An army official said he had received reports of ''a major incident'' at the Rafah camp, but needed to check further before he could comment.

Rolf van Uye, a spokesman for the U.N. Relief and Works Agency, said the bodies of four Palestinians were taken to Nasser Hospital in nearby Khan Yunis.

He said the U.N. clinic in the camp treated between 30 and 50 Palestinians for gunshot wounds. Some of the wounded were in serious condition, he said.

Van Uye said Israeli soldiers prevented U.N. ambulances from entering or leaving the camp.

The incident came as Palestinians were preparing for the end of the fasting month of Ramadan, the holiest time of the Muslim calendar.

The clash began shortly after 6:30 p.m. in the Rafah camp on the southern edge of the coastal strip, van Uye said.

It was not immediately clear what caused the clash. Arab reports said it began after two jeeps full of paramilitary border police pursued Palestinian activists in a Gaza car into the market area of the camp. The Arab said stones and a bomb were thrown at the troops.

Palestinians said the army imposed a curfew on Rafah, confining people to their homes and preventing journalists from entering.

The clash was the worst in the occupied territories since April 13, 1989, when border police stormed the West Bank village of Nahalin in a raid, killing five Palestinians.

In Jerusalem, 17 Palestinians were killed on Oct. 8, 1990, when police stormed the Temple Mount area after stones were thrown at Jewish worshippers.