Mikhail S. Gorbachev urgently headed for home Thursday to cope with the crisis of a devastating earthquake, expressing confidence that superpower relations were on track after a summit with President Reagan and President-elect Bush. The American leaders expressed condolences and offered U.S. assistance.

Gorbachev, standing on a windswept runway at John F. Kennedy International Airport, said his talks with Reagan and Bush in New York on Wednesday and by telephone Thursday made him confident "that our relations will expand and improve on the basis of cooperation, on the basis of mutual respect for each others' interests."The Soviet leader said, "The road ahead will be tough, but we will go ahead."

Soviet officials said Gorbachev cut short his New York visit, and scrapped stops in Cuba and Britain, because of an earthquake in Soviet Armenia that killed thousands of people. Gorbachev said there were "extremely grave consequences, devastation and great loss of life. I urgently have to return to the Soviet Union."

During a visit of less than 48 hours in Manhattan, Gorbachev drew praise from Reagan and Bush for his announcement of a unilateral, 500,000-man reduction in Soviet troops and cutbacks in artillery, tanks and planes.

Expressing gratitude to Reagan and Bush for U.S. offers of earthquake help, Gorbachev said, "I would like to thank them and thank the American people for those feelings and for their readiness to give assistance in this difficult hour."

Reagan, in his farewell telephone call, expressed "deep personal sorrow" over the earthquake tragedy. The president, speaking from his second-floor living quarters in the White House, also told Gorbachev their meeting on Wednesday was "very useful . . . for both sides."

He expressed concern over the magnitude of the Soviet loss. "If there is any way we can be of assistance, either bilaterally or through the international community, please let me know," Reagan said. His comments were relayed to the press by White House spokesman Marlin Fitzwater.

Nancy Reagan also spoke with Raisa Gorbachev, expressing sorrow over the quake and saying she and the president hope to see the Gorbachevs again, either in California or the Soviet Union.

Soviet officials said Gorbachev was returning home to direct relief efforts after the quake in Armenia, which produced casualties numbering in the thousands. That meant junking an elaborately planned day of sightseeing in New York, as well as trips to Cuba and England that had been on the schedule for later in the week.

British Prime Minister Margaret Thatcher, standing outside 10 Downing Street with the Soviet ambassador to London, endorsed Gorbachev's decision to cut off his trip. "Obviously his place is at home at this time," Thatcher said.

At least one event planned for the Soviet leader went on without him. A Soviet trade show opened, with goods ranging from vodka to furs and to fruits on display. Viktor Kamentsev, a deputy Soviet premier, opened the show along with C. William Verity, the U.S. secretary of commerce.

Gorbachev was making his hasty exit from New York while Western leaders were trying to digest his announcement of a cut of 500,000 troops, including withdrawal of 50,000 from Eastern Europe.

Reagan and Bush both heartily embraced the announcement when it was made on Wednesday.

Secretary of State George P. Shultz met Thursday with NATO allies to try to persuade them to insist on further cutbacks in Soviet troops in Europe beyond those Gorbachev offered to withdraw from East Germany, Czechoslovakia and Hungary.

In his farewell meeting with the 15 foreign ministers, Shultz hoped to keep the allies focused on the 2-to-1 manpower edge U.S. officials say the Warsaw Pact still enjoys.

Gorbachev's early departure was an unexpected ending to the Soviet leader's New York visit.

He melted diplomatic reserve at the United Nations with a sweeping disarmament pledge, met cordially for two hours with Bush and Reagan and even managed a quick motorcade tour of Manhattan, jumping from his limousine to greet startled New Yorkers on the sidewalk.

Reagan, Bush and Gorbachev all were in high spirits when they met for two hours on heavily guarded Governors Island in New York Harbor. When Bush offered a welcoming handshake, Gorbachev seized it in a two-handed embrace.

After two hours of talks, Reagan summed up the mood. "Read our smiles," the outgoing president said.

Extending an olive branch to Bush, Gorbachev said in his speech at the United Nations that the new administration "will find in us a partner who is ready - without long pauses or backtracking - to continue the dialogue in a spirit of realism, openness and good will."