Patrick O'Hara, the last of the initial quartet of imprisoned Irish Republican hunger strikers, died late last night, less than 24 hours after the death this morning of fellow guerrilla Raymond McCreesh. Both were 24 and in the 61st day of their fast.

McCreesh was the third convicted Irish Republican Army inmate to die on hunger strike in the last three weeks. O'Hara, the fourth, belonged to a more extreme Republican group.

The strikers are pressing demands for political-prisoner status at the Maze Prison outside Belfast. The British government has continued to reject the demand, most recently Wednesday night, on the ground that it would legitimize the violent tactics of the IRA, which aims to unify Northern Ireland with the Irish Republic to the south.

The IRA, which has replaced each dead man with a new hunger striker, did so again yesterday after McCreesh's death, naming Kieran Doberty, 25, who is serving 22 years for possession of a firearm and explosives.

News of McCreesh's death at 2 yesterday morning was spread through Belfast's Catholic ghettos by the now-traditional means of beating garbage-can lids and blowing whistles. Hundreds of Catholic youths responded by attacking security forces in Belfast and Londonderry, the second-largest city in the British-ruled province. They hurled rocks and molotov cocktails and blocked roads with hijacked trucks while women gathered on sidewalks to say the rosary for McCreesh.

But violent protest was limited to the poorest Catholic areas, and after being fired on once this morning in Belfast, British soldiers appeared to control the streets by midday.

The same pattern was repeated after O'Hara's death, with mobs of Roman Catholic youths attacking police and British troops in Londonberry, O'Hara's hometown, in Belfast and in Dungannon, 40 miles to the east.

[Catholics stormed the streets across Northern Ireland and pelted security forces with gasoline bombs and rocks, injuring at least three soldiers, United Press International reported early Friday. UPI said snipers fired at police and British soldiers trying to contain the rioting. Two civilians were injured in sniper fire in Belfast, police said.]

McCreesh was serving a 14-year sentence for attempted murder and firearms offenses. He was captured by British soldiers after an unsuccessful IRA ambush in 1976.

O'Hara was serving an eight-year jail term for possession of explosives.

Five British soldiers were killed by a half-ton IRA land mine three days ago only three miles from McCreesh's home village of Camlough in the border district of south Armagh. Since the first IRA inmate began fasting on March 1, 26 persons have died in terrorist incidents in Ulster, 12 of them in the security forces, a British official said today.

Yesterday afternoon thousands of mourners followed McCreesh's coffin, which was draped with the tricolor flag of the Irish Republic and the gloves and black beret of an IRA activist as it was taken to Camlough. The Rev. Brian McCreesh, the dead man's brother who was with him when he died and supported his decision to refuse food, said McCreesh's last request was that his death not spur more violence.

"It was Raymond's wish that there should be no trouble after his death," he said. "I would ask in particular that young people should not get in any trouble." The IRA is expected to give McCreesh a full "military" funeral on Saturday.

O'Hara was a member of the militant, Marxist Irish National Liberation Army. The group claimed responsibility for the killing in Marcxh 1979 of Airey Neave, Prime Minister Margaret Thatcher's close confidant and adviser on Northern Ireland.

The other deceased hunger strikers were Bobby Sands, who was elected a member of the British Parliament for a Northern Irish constituency before his death on May 5, and Francis Hughes, who died May 12.

Local government elections were held Wednesday in the province and early results indicated that hard-liners have gained against moderates in a race for 526 seats in 26 districts. The Democratic Unionist Party, led by the militant Protestant leader, the Rev. Ian Paisley, appears strengthened.

The new Irish Independent Party, which supports the hunger strikers and the goal of unification of Northern Ireland with the Republic, also appears to have gained ground against more moderate, mainly Catholic parties. "It looks like the communities are ploarizing," a diplomat specializing in Northern Ireland said yesterday.

Meanwhile, Irish Prime Minister Charles Haughey, citing the "grave and tragic situation" in Ulster as a factor, called a general election to be held on June 11. Although Northern Ireland is unlikely to be the decisive issue in the campaign, diplomatic observers say it will be a significant one.