Guerrillas ambushed a Syrian Army patrol in northern Lebanon this afternoon, killing seven, including two colonels, security sources said.

Sources in the northern port city of Tripoli said unidentified guerrillas detonated a roadside bomb as two jeeploads of Syrian troops traveled near the Christian town of Anfah on the coastal highway about 40 miles north of Beirut.

As the jeeps exploded into smoke and flame, the gunmen, hiding nearby, opened heavy machine-gun fire on them, the sources said.

Earlier today, three soldiers were wounded when their ammunition-loaded truck exploded near the scene of the later ambush, but that appeared to be an accident.

The ambush appeared to be the worst attack against the Syrians and comes amid rising violence in Lebanon, including the northern areas they occupy. Four days ago gunmen sped through Tripoli and killed 18 persons on a crowded beach, at a garage and elsewhere. Four Christians in Anfah were among the victims.

Security sources had no information on who might be responsible for the ambush on the soldiers today. The Syrians, who have not undergone the kind of sustained guerrilla attack Israeli troops occupying southern Lebanon face, have, nevertheless, numerous enemies here.

They include the Christian Lebanese Forces militia, Moslem fundamentalists and some elements of the Palestine Liberation Organization who have blamed Syrian President Hafez Assad for fomenting dissent and division within the PLO.