President Reagan sent a fence-mending message today to caretaker Prime Minister Bettino Craxi, saying that U.S.-Italian relations remain "comfortable, deep and solid" despite the two nations' "differences" over the handling of the hijacking of an Italian cruise ship.

Reagan's message to Craxi, who was forced to resign Thursday because those differences triggered the collapse of Italy's 26-month-old coalition government, was contained in a brief personal letter delivered by U.S. Deputy Secretary of State John C. Whitehead.

In his letter Reagan said he was "anxious" to see Craxi at next week's summit meeting of five industrialized countries in New York, which Reagan had called to precede his summit with Soviet leader Mikhail Gorbachev next month.

After receiving the letter at his offices at the Chigi Palace here, Craxi emerged terming the meeting with Whitehead "warm and friendly." He said he would be "delighted" to attend the talks in New York unless prevented by "formal impediments" related to Italy's current political crisis.

Whitehead, saying he and Craxi agreed that the "events of the past few weeks" showed the need for "better coordination" among western allies in the fight against terrorism, added, "We also agreed that both of our countries have an important stake in maintaining and enhancing the broad and deep relations that we have had in the past."

From Rome, Whitehead flew to Egypt, another country whose strong relations with Washington have been set back in the aftermath of the hijacking of the Achille Lauro on Oct. 7. From there, he will travel to Tunisia, whose traditionally good relations with Washington have been undercut by Reagan's initial support for Israel's bombing raid against the headquarters of the Palestine Liberation Organization outside Tunis on Oct. 1.

Consultations aimed at ending Italy's political crisis with the formation of a new government wound up today with reports of agreement among some outgoing coalition members on reconstituting the outgoing grouping. President Francesco Cossiga is expected to ask Craxi to put together a new government comprising the same five parties -- the Socialists, Christian Democrats, Liberals, Republicans and Social Democrats.

The crisis was precipitated when Defense Minister Giovanni Spadolini, the leading Republican Party representative in Craxi's coalition, pulled his three ministers out of the government because of Craxi's response to the hijacking and the release last Saturday of the man alleged by Washington to have been its mastermind. Spadolini, who has opposed Craxi's pro-Arab foreign policy in favor of a more pro-Israeli stance, sided with U.S. criticisms of Craxi.

U.S. actions during the crisis have prompted angry charges from the Italian media and commentators that Washington was treating Italy, a steadfast ally in Europe, as a "banana republic" or with the same "arrogance" that the Soviet Union treats its satellites in Eastern Europe.

In Washington, President Reagan told Italian Ambassador Rinaldo Petrignani, "I assure you the friendship between our two countries is unshakable." Reagan was addressing the 10th anniversary dinner of the National Italian-American Foundation.

The dispute between Washington and Rome hinged in part on the way U.S. officials behaved after U.S. Navy jets intercepted an official Egyptian airliner carrying the alleged hijackers and two senior Palestinian officials who had helped mediate their surrender. The plane was forced to land at a U.S.-Italian naval air station in Sigonella, Sicily, where a dispute began over U.S. demands to take the hijackers and the PLO officials to the United States for prosecution, which the Italian government refused.

Outgoing Foreign Minister Giulio Andreotti, a Christian Democrat, revealed today that Italy heard that the Egyptian plane was on its way to Italy before it learned, from Reagan, that the jet had been intercepted in the air over Mediterranean and forcibly diverted.

In a conversation with American reporters, Andreotti said he was advised by the Egyptian ambassador in Rome about 11:40 or 11:50 p.m. Oct. 10 that the Egyptian plane was flying to Rome. Craxi has said that he first heard of the interception in a phone call from Reagan asking for permission to land the plane at Sigonella.

Andreotti said the initial news of the plane coming to Rome "made us happy because it would have allowed us to proceed right away with the arrest of the four without going through all the bureaucratic procedures." Had the plane landed at a commercial airport as Andreotti had first expected, much of the conflict with the United States might have been avoided.

Meanwhile, political sources close to the caretaker prime minister said that he would go to the New York summit if, as is generally expected, he is named by Cossiga to try to form a new coalition government.

Whether Craxi, the first Socialist prime minister in Italy since World War II, will be able to put together a new government again is an open question. Italian political commentators today predicted that formation of a new government would not be easy or quick and that Craxi in the end might fail.

Ciriaco de Mita, the leader of the Christian Democratic Party, Italy's largest, said today after meeting with Cossiga that his party favored trying to put together a new five-party coalition under Craxi because that solution made the most sense. Both the Liberals and the Social Democrats, minor members in the old alliance, agreed.

Spadolini, the Republican prime minister whom Craxi had replaced in office in 1983, took the U.S. position in the dispute over allowing Mohammed Abbas, who the U.S. charged had masterminded the ship's hijacking, to leave Italy for Yugoslavia last Saturday. He eventually pulled the plug on the coalition, alleging lack of consultation by Craxi about Abbas' release. Craxi disputed that claim.