The most severe rioting of Northern Ireland's recent troubles convulsed the British-ruled province today, while local council election results showed a significant hardening of political opinion among both the Catholic minority and Protestant majority.

With news of the death late last night of hunger striker Patrick O'Hara, 24, a member of the splinter Irish National Liberation Army, and earlier in the day of Irish Republican Army member Raymond McCreesh, rioting in poor Catholic areas of Belfast and Londondery raged until dawn. Both had fasted 61 days in Belfast's Maze Prison.

The violence has escalated, with a marked increase in shooting attacks rather than the now-ritual stoning and gasoline bombing of security forces in the British-ruled province. One Catholic died of head injuries after rioting in Londonderry, another was wounded by a bullet after six shooting incidents in Belfast and police reported six soldiers injured by bombs as security forces fired scores of plastic bullets at rampaging crowds of Catholic youths who burned down several buildings.

A 12-year-old girl shot in rioting Tuesday died, bringing the toll this year to 40.

McCreesh and O'Hara were the third and fourth convicted Irish Republican terrorists to die on hunger strike in the last three weeks. They were demanding special treatment as political prisoners rather than criminals. Brendan McLaughlin, another IRA hunger striker at the prison, is reported to be in serious condition with a bleeding ulcer after eight days without food. He is refusing medical treatment and could deteriorate rapidly.

The IRA has replaced each dead hunger striker with a new volunteer to keep total of four prisoners refusing food and prisoners Kieran Doherty and Kevin Lynch, both 24, were reported to have joined those refusing to eat.

Tensions in the province are high. Apparently the British government had not anticipated that the situation would become so when the IRA hunger strike began on March 1. A previous such strike in December ended with little difficulty.

This hunger strike appears to have seriously polarized the people of Ulster, with the province's Protestant majority demanding continued union with Birtain on one side and the Catholic minority, many of whose members aspire to eventual unification with the Irish Republic to the south, on the other. About two-thirds of the 1.5 million population is Protestant.

In an impressive 70 percent turnout for local council elections two days ago, clearly seen as a vote on the future of Northern Ireland rather than simply local issues, moderate political parties lost ground to hard-liners on both sides. This has raised fears among British and Irish observers that room for political compromise has slipped away.

With a fifth of the votes still to be counted, the Rev. Ian Paisley, who has led a series of Protestant demonstrations against any change in the status of Northern Ireland, led his Democratic Unionist Party to a major victory in the race for 521 seats in 26 districts, doubling its vote and overtaking the more moderate Protestant Unionist Party.

Paisley, describing himself as the chief spokesman for Protestant opinion, called on security forces today to shoot those throwing molotov cocktails. "If a person takes a petrol bomb and the police are going to be seriously damaged and perhaps burned to death, they have a right to shoot them," he said. d

The moderate, mainly Catholic Social Democratic and Labor Party, which has been the leading Catholic organization, lost ground to extremist independent Catholic candidates and a new group, the Irish Independence Party, which supports the hunger strike. The brother of a deceased hunger striker won a seat for the new party, which is expected to take up to 4 percent of the votes in an impressive first showing.

Gerry Fitt, an independent Catholic candidate for working-class West Belfast, scene of much of the rioting, lost the seat he has held for 23 years. bAlso a member of the British Parliament, Fitt ran on the slogan "a vote for me is a vote against the gunmen." He blamed his defeat on people voting "along tribal lines."

"I am very pessimistic about the future of Northern Ireland," Fitt said after his defeat. "The community has polarized into two tribes, Protestant and Catholic, and whatever the government does to please one will displease the other."

John Hume, leader of the Social Democratic and Labor Party who helped settle the previous hunger strike and has tried to help solve the present one, said moderate Catholics had stuck to his party in "very tense circumstances." He criticized British "intransigence" in handling the hunger strike.

Hume said he would ask the British government to consider "more urgently" new political arrangements for Northern Ireland with the Irish Republic -- where an election was announced yesterday in which Ulster will be a major issue. Thatcher is due to meet Irish Prime Minister Charles Haughey, if he is reelected, to discuss "the totality of relations" between Britain and Ireland, probably in July. Hard-line Protestants oppose the meeting.

British officials express relief that widespread sectarian killing has not occurred in this latest phase of Ulster's troubles, but a Northern Ireland police official tonight described the province as "a powder keg waiting to explode."

Cardinal Tomas O'Fiaich, Roman Catholic primate of all Ireland, yesterday warned after the deaths of the two hunger strikers that IRA recruitment was at its highest level since 1972, when hundreds died. He warned the British government that if a compromise is not found soon it would face near civil war.

"In near desperation, I appeal to both sides for the fifth time to bring the hunger strike to an end," he said.