NABATIYEH, Lebanon (AP) _ Lebanese guerrillas attacked Israeli troops and allied militiamen in south Lebanon today, and the Israelis responded with an artillery barrage that killed two guerrillas, police reported.

A police spokesman said the guerrillas attacked an outpost on the northern edge of the Israeli-controlled sector of Lebanon with rocket-propelled grenades and machine guns.

Security sources in south Lebanon, speaking on condition of anonymity, said one Israeli soldier was slightly wounded.

Hours earlier, the guerrillas had launched mortars and rockets on a nearby post manned by Israeli-affiliated militiamen of the South Lebanon Army.

The police spokesman, who cannot be identified in line with regulations, said Israeli troops and SLA militiamen responded with a fierce howitzer barrage against the guerrillas' escape routes in Nabatiyeh and nearby Kfar Rumman.

He said two guerrillas were killed in the shelling but did not identify them or their affiliation.

The area has been the site of frequent clashes between Israel and fundamentalist Shiite Muslim Hezbollah guerrillas who want the Israelis out of Lebanon.

Israeli gunners on Tuesday shelled suspected hideouts of Iranian-backed Hezbollah guerrillas in the wooded hills of the Apple Province, north of Nabatiyeh.

The police said Hussein Kansou, a Hezbollah fighter, was killed in the barrage.

Meanwhile, security sources said Israel had pulled out nine more howitzers from its self-proclaimed ''security zone'' in the south, suggesting that prospects of a major outbreak of violence between the Jewish state and guerrilla factions may have decreased.

Israel carved out the 440-square-mile area in the summer of 1985 to buffer against guerrilla infiltrations into its northern settlements.