RAMALLAH, Occupied West Bank (AP) _ The Israeli-appointed mayor of the West Bank town of El-Bireh was stabbed in the chest today in an apparent assassination attempt by Palestinian militants.

The stabbing of Hassan Tawil, in his 70s, follows repeated demands by underground leaders of the 6-month-old Palestinian uprising that he and other Israeli-appointed officials resign their jobs in the occupied West Bank.

Tawil was taken to nearby Ramallah Hospital, where officials said he was in stable condition after surgery.

He was stabbed once with a ''very long knife'' that pierced his heart, diaphragm, liver and stomach, said the officials, who spoke on condition of anonymity.

Brig. Gen. Shaike Erez, head of the military government in the West Bank, said Tawil was attacked near the city hall in El-Bireh, a town of mostly Moslems about nine miles north of Jerusalem.

Shortly after the stabbing, Associated Press photographer Martin Cleaver saw Tawil lying slumped against a shuttered store front. He was surrounded by Israeli troops.

Tawil appeared ashen-faced and had a large, bloody stab wound on the left side of his chest, which was partially covered with a bandage.

Cleaver said four soldiers commandeered an Arab vehicle, climbed inside with Tawil and rushed him to the hospital.

''The mayor left his office without his bodyguard. Almost at the threshhold he was stabbed,'' Police Minister Chaim Bar-Lev told reporters at the stabbing scene.

Hussein Tawil, a son of the mayor, said a driver who also acted as a guard was with his father at the time of the attack. He said the man was being questioned by police. However, Bar-Lev said the mayor was alone.

The police minister said a knife was found near the scene. Asked whether any suspects were in custody, he said only that the investigation had just begun.

''I assume it's a nationalistic motive,'' Bar-Lev added, meaning the attack was made by Palestinian nationalists.

Three Israeli soldiers guarded Tawil's room at Ramallah Hospital and prevented even family members from entering.

When Hussein Tawil appeared, he said, ''Let me in. I want to see my father.'' But soldiers pushed him away.

Two army jeeps were parked outside the hospital and about 20 soldiers surrounded the building.

The army set up roadblocks and imposed a curfew on El-Bireh, confining the 10,000 residents to their homes.

Yusef Taher, one of four members of the El-Bireh city council, blamed the attack on Palestinian militants and said, ''I had hoped we would not descend to the level of assassination.''

Israel army radio said it received an anonymous telephone call from a Hebrew-speaking man who took responsibility for the stabbing but did not identify any group as having carried out the attack.

The radio quoted him as saying: ''We are sick of the stone throwers. That's why we did it,'' implying the attackers were Jewish extremists.

But both diplomatic sources and Palestinian journalists discounted the call, saying the attack was more likely the work of Palestinian militants.

Tawil was one of three mayors appointed by the Israeli government in September 1986 as part of an effort to gain cooperation from Palestinian moderates. The Palestinian mayors replaced Israeli officials who had been running the municipalities.

The appointments immediately provoked opposition in the West Bank, where Palestinian extremists often have threatened to assassinate those who cooperate with Israel's government.

In March 1986, Mayor Zafer El-Masri of Nablus was slain in front of his office three months after Israel appointed him to govern the West Bank's largest city. Last October, two Palestine Liberation Organization members were sentenced to life in prison for the slaying.

Today's attack follows repeated calls in underground leaflets - signed by the PLO-backed United Leadership of the Uprising - for Israel-appointe d mayors and city officials to resign.

According to army officials, there are Israeli-appointed mayors in about a dozen towns and cities in the West Bank. Heads of about 85 village councils also are appointed by the military government.

On Monday, Israeli troops opened fire at rioting Arabs in the occupied Gaza Strip hours after Richard Shifter, U.S. assistant secretary of state for human rights, toured the area with U.S. Ambassador Thomas Pickering. A 9-month-old Palestinian child lost an eye in the shooting.

Three other Arabs were injured Monday in protests in the strip's Jabaliya refugee camp. In the West Bank, a 16-year-old Palestinian boy was wounded when troops chased stone-throwers.

Also Monday, the army reopened high schools for 36,000 students in the West Bank and released more than 100 Arab teen-agers from jail so they could attend classes.

Schools had been closed since February and Israeli officials said their reopening indicates a waning of the anti-occupation uprising, in which 202 Palestinians and two Israelis have been killed.