Tensions in the Israeli-occupied West Bank rose sharply today when a Palestinian student was shot to death after allegedly attacking an Israeli military governor with a knife during a demonstration in the Arab village of Anabta near here.

Israeli military authorities said the youth, masked and carrying a Palestinian flag, was slain while scuffling with an army captain who had gone to the village with Lt. Col. Mutsafi Shalom, the military governor of the Tulkarm district, to investigate students throwing rocks at passing Israeli vehicles.

Officials said three youths hurled rocks at Shalom and his aide, Capt. Amit Zaid, and that the governor chased and overpowered two of them. Meanwhile, authorities said, Zaid struggled with the third youth, identified as Najoh Ahmed Abu Alia Ghouli, 17, and the officer's weapon discharged once.

While Israeli soldiers are the targets of surreptitius attacks by West Bank youths, such as hit-and-run rock-throwing, the alleged knife attack illustrated the escalation of violence in the occupied territory in recent weeks. Hand grenades and molotov cocktails have been thrown at passing military vehicles and troops have been increasingly opening fire over the heads of demonstrators.

Some Palestinian leaders have warned that the West Bank is on the brink of open revolt against occupation, but Army Brig. Gen. Binyamin Ben-Eliezer, while acknowledging an upsurge in nationalism, said the situation is far from reaching widespread insurrection. "The military government . . . will under no circumstances allow this area to be transformed into the Wild West. We shall respond with violence to manifestations of violence, and we will not allow the process of radicalization and escalation in the areas to continue to gain strength," Ben-Eliezer said.

As usual, there were conflicting accounts of what happened in the Anabta schoolyard, about 12 miles west of here. Military authorities said the Tulkarm governor and his aide were summoned by a school official, who complained students were stoning vehicles on the Nablus-to-Tulkarm road.

Officials said they had no explanation of why Shalom and Zaid went alone, unescorted by troops, as is normally the case. One Army officer said Anabta had been relatively quiet in terms of anti-Israel demonstrations and the two may have felt no need for an escort.

Officials said when the youths attacked, the officers first shot their weapons in the air, and then chased them. Zaid, they said, was struck in the head several times with a brick before his weapon went off.

Palestinian sources denied the officers had been assaulted and said Zaid and Shalom "broke into" the schoolyard to break up a student strike. They said the two students with Ghouli were beaten up and hospitalized.

Anabta was shut down by a general strike following the incident, and the mayors of all the towns in the northern half of the West Bank planned a meeting to discuss actions to be taken.

Following the incident, the Army set up numerous roadblocks and searched vehicles for weapons.

On Monday, hundreds of Arab residents of Ramallah demonstrated after ultranationalist Jewish settlers went to the municipal building to demand the Arabs leave the West Bank. In a clash with troops, one youth was shot in the leg and several others were hospitalized with injuries.