An unidentified attacker fired a rocket at a Jordanian airliner in Athens yesterday in the fifth attack in two weeks against Jordanian interests abroad, apparently by hard-line Arab factions opposed to King Hussein's joint effort with Palestine Liberation Organization leader Yasser Arafat to negotiate a Middle East peace.

In Amman later, Hussein announced a shuffling of his Cabinet, replacing Prime Minister Ahmad Obeidat, who had been in office only four months, with Zeid Rifai, who is known to be on much better terms with Syria, a leader of the Arab opposition to the Jordanian-PLO peace initiative. No reason was given for the change.

The rocket hit the Jordanian Boeing 727, which was preparing to take off with 62 passengers and a crew of 13, and gouged a four-inch-wide hole in the roof but failed to explode and caused no injuries, a Greek police spokesman told The Associated Press. The plane returned to the terminal.

The attacker, who fired at the plane from near the runway, dropped the rocket launcher and ran to a car, the spokesman said. He said the pilot of an Olympic Airways plane coming in to land saw the incident and alerted the control tower.

By late last night, no one had claimed responsibility for the attack, but U.S. and diplomatic sources said here that it appeared to be linked to four recent attacks against Jordanian facilities abroad, as protests against an agreement Feb. 11 between Hussein and Arafat for a joint initiative to seek peace in the Middle East through negotiations with Israel and other states.

On March 21, in almost simultaneous attacks, grenades were thrown at Jordanian airline offices in Athens, Rome and Nicosia, Cyprus, injuring five persons. Wednesday, a rocket was fired at the building housing the Jordanian Embassy in Rome, causing damage but no injuries.

After each of those attacks, callers claimed responsibility on behalf of Black September, a Palestinian terrorist group active in the early 1970s but thought to be disbanded. In the attack in Rome on Wednesday, police arrested a suspect, who identified himself as a member of Black September.

A caller to Agence France-Presse in Paris said Wednesday, "We shall continue to strike blows to topple the mercenary Jordanian regime so that the Jordanian masses can take part in the struggle against reactionary conspiracies of the agents of Zionism and imperialism."

Sources here and in the Middle East said the name Black September apparently was being used to cover the actions of hard-line Palestinian factions backed by Syria and Libya and probably headed by Abu Nidal. He is a longtime foe of Arafat, and his faction has claimed responsibility for several terrorist attacks and killings of moderate PLO figures during the past 12 years.

One U.S. source called use of the Black September name "disinformation," saying the recent attacks appeared to be the work of Abu Nidal, who now is based in Syria.

Jordanian Embassy spokesman Akram Barakat said yesterday that Jordan had "no evidence" who was behind the attacks and was "not accusing anybody." But when asked about Abu Nidal, he said there was "a strong possibility" he was involved "because he has threatened to attack . . . the moderate part of the PLO, which has joined forces with Jordan" in the peace initiative.

Rifai, the new Jordanian prime minister, is highly experienced in foreign affairs and in inter-Arab politics. He headed the government from 1973-76 and again in 1977, during a period of intense Middle East diplomacy, and he improved relations with Syria while maintaining close ties with the United States.

Obeidat, on the other hand, was a former interior minister and head of the intelligence service. Callers claiming responsibility for the recent attacks specifically had criticized Jordanian intelligence services.

Hussein's decree gave no reason for the change but said: "Our goal shall continue to be the regaining of Arab solidarity and the encouragement of inter-Arab dialogue in the interest of the Arab nation, particularly with regard to central Arab issues."

Barakat said here that "we do hope there will be a chance for a closer relationship with Syria" and that the new Cabinet would work toward this goal. "We hope the response from Syria will be positive," he said.