In a flying seven-hour visit, Andrew Young, U.S. ambassador to the United Nations, patched up U.S. relations with Ghana, offered to medicate in a student demonstration and had impromptu talks with a major Blagu nationalist Rhodesian leader.

Only the first item was on his official agenda. But despite the wilting, humid weather, Young talked with students and met with the Rev. Ndabaningi Sithole, one of four major Rhodesian nationalist leaders.

Shortly after Young and his party arrived in Accra from the Ivory Coast, a group of university students - their leader claimed that they were 2,000-strong - sought to march to the city center in an antigovernment protest.

Although the student leaders insisted to reporters that their demonstration was not intended to embarrass the government during Young's visit, the American diplomat later said Gen. I. K. Acheampong, the chief of state, had told him he was convinced that that was their goal.

Young said he offered "to use my good offices . . . since I'm very much at home with student demonstrator," but his hosts showed no onterest.

In his talks, Young sought to support the Acheampong military government, which has grown increasingly unpopular because of rising prices, a worthless currency, widespread corruption and its refusal to hand power back to civilians.

Young balmed Ghana's problems on quadrupled oil prices and a drop in the price of bauxite, a major export.

Young's visit was visible evidence that a rift with the United States over the cancellation of a scheduled visit last April by Secretary of State Henry A. Kissinger was over.

"They were desperate to kiss and make up," one foreign diplomat said in explaining Ghanian embarrassment over the incident. No official reason was ever given for the cancellation fo the Kissinger visit, but explanations ranged from presure from Nigeria and the Soviet Union to Acheampong's sudden illness.

In answer to a reporter's question, Acheampong showed his pleasure with the new American administration. He said, "I can assure you, and I have expressed this feeling to Ambassador Young, and I have asked him to convey to President Carter, that we do appreciate the efforts his government is making and we are confident that success will come if they go on the way they have started."

It was shortly before noon when Young agreed to a half-hour meeting with Sithole, who had remained here after a meeting last week convened by the Ghana government in an effort to end the divisions among the rival Rhodesian liberation movements.

Young sought ot impress on Sithole the importance of "rational transition" in Rhodesia - where some observers fear a civil war if black nationalists fail to settle their differences before taking over from the white minority now in power.

[In Cape Town, South Africa, Foreign Minister R. F. Botha said South Africa had "no objections" to a visit by Young. Botha said South Africa had been "reassured" by U.S. official visit, and noted the original plans had been changed so that Young's visit would not conflict with a planned U.S.-South African conference in Europe.]