LONDON, Dec. 27— In a number of ways, the fortunes of Yuri V. Andropov have been linked to those of Hungary. Mr. Andropov, the new Soviet party leader, served in the Soviet Embassy in Budapest from 1953 to 1957, initially as a second-rank official, then as Ambassador. 
Those were troubled times, marked by growing unrest, by the 1956 uprising and by the installation of Janos Kadar as head of the Hungarian Communist Party. 
So were the years that followed. Mr. Kadar began evolving his program of economic decentralization, and Mr. Andropov, by then back in Moscow, was largely responsible for allowing him to develop the program in his position overseeing the Central Committee's dealings with Eastern Europe. Hungarians Willing to Talk 
Mr. Andropov's tenure in Hungary gives his background a special quality. No other top Soviet leader since Lenin has ever lived outside the Soviet Union. And it offers the West a chance to learn something about the man. The Hungarians know him well, and they are willing to talk; people in the Soviet Union have usually found it prudent to say nothing, or to hew to a prearranged line, in discussing the country's leaders. 
The recollections of some Hungarians interviewed in Budapest afford little if any insight into Mr. Andropov's years as the head of the K.G.B., the Soviet intelligence and internal-security agency, and even less into the way he fought his way to the top of the Politburo. They also relate mainly to events of long ago. So the picture is limited, and perhaps somewhat distorted, but it is probably better focused than those that can be readily obtained in the Soviet Union. 
On Nov. 1, 1956, with the streets of Budapest blackened from battle, with Soviet forces pouring into the country despite their agreed withdrawal from the capital, Imre Nagy, the leader of the Government, who sought to bring about change, found himself under pressure from all sides. He called Mr. Andropov to his office and denounced the troop movements. 
The Soviet Ambassador said he knew nothing of this but promised to find out. Some time later, after what Hungarians close to the situation have described as a heated telephone conversation, he gave his word that the influx of Soviet troops would be halted. 
But it was not. By 2 P.M. the Nagy Cabinet had made the fateful decision to pull out of the Warsaw Pact, and by 5 P.M. Mr. Nagy was reading a declaration of neutrality to Mr. Andropov. 'Hungary's Best Friends' 
The next day, the new commander of the national guard, Gen. Bela Kiraly, was sent to the Soviet Embassy to look into the Ambassador's complaints that Hungarians were sacking it. Mr. Kir@aly, who now teaches at Brooklyn College, remembers that Mr. Andropov assured him, ''Believe me, general, the Soviet people are Hungary's best friends.'' He offered immediate negotiations to discuss a new withdrawal of the Soviet troops. 
''Here was this man Andropov who clearly understood what was going on,'' Mr. Kiraly said bitterly, ''yet he pretended until the last moment to me and to the Prime Minister and to others that everything was business as usual. Even pirates, before they attack another ship, hoist a black flag. He was absolutely calculating.'' 
According to several Hungarian sources, Mr. Andropov had already begun to make his plans for the country's future. On Nov. 1, Mr. Kadar, First Secretary of the party, and Ferenc Munnich, the Minister of the Interior in the Nagy Government, stopped at the Soviet Embassy and talked for some time, apparently to the Ambassador. Miklos Vasarhelyi, Mr. Nagy's press aide, who later spent four years in prison, said, ''It was Andropov who talked to him first, and it was Andropov who persuaded Kadar to go over to the Soviet viewpoint.'' Negotiations With the Russians 
From the embassy the two Hungarians were taken to the Tokol air base, outside Budapest, to Uzhgorod across the border in the Carpathian Ukraine and on to Moscow. In a speech in 1957, Mr. Kadar said he began negotiations with ''the Soviet comrades'' on Nov. 2; ''by Nov. 3, we were all set, and on Nov. 4, the offensive began'' - the closing of the Soviet pincers around Budapest. 
It is widely believed in Budapest that Mr. Andropov was one of the key figures in persuading Nikita S. Khrushchev to install Mr. Kadar as Mr. Nagy's replacement. Khrushchev himself preferred Mr. Munnich, who had fought in the Russian Revolution and in the Red Army in World War II. 
On the night of Nov. 2-3, however, Khrushchev was meeting President Tito of Yugoslavia at the latter's island retreat of Brijoni in the Adriatic Sea. According to the diary of a Yugoslav diplomat who was present, Tito argued strongly that Mr. Kadar would be more likely to attract a genuine popular following in Hungary, not least because he had served time in jail under the Stalinist Government of Matyas Rakosi. 
''Andropov knew the opinion of Hungarian party leaders better than anyone else, and he knew the mood of the people,'' a close associate of Mr. Kadar said. ''When Tito opted for Kadar, Andropov was in position to support him.'' From 'Comrade' to 'Mr.' 
Janos Berecz, the editor of Nepszabadsag, the Hungarian party's daily newspaper, has written extensively about the events of 1956 and their sequels. A trusted Kadar loyalist, he nevertheless has a reputation for plain speaking, and he has pointed views about the meaning of the new Soviet leader's experiences in Hungary. 
Mr. Berecz said in an interview in his Budapest office, with a picture of Lenin, but none of Mr. Kadar, looking down from the wall: ''When the Government changed, he stopped being Comrade Andropov and started being Mr. Andropov. He learned from that experience. He knows perfectly well that the crisis here, and similar crises elsewhere in Eastern Europe, have nothing to do with Western imperialists arriving here and manufacturing difficulties. He knows that crises arise from within and have to be solved from within. That counts for a lot.'' 
According to Mr. Berecz, a former head of the foreign department of the Hungarian Central Committee, Mr. Andropov continued to monitor Hungarian affairs closely, even after he gave up direct responsibility for relations with Hungary. He met often, the editor said, with Mr. Kadar in Moscow, and supported his policies in the Politburo. Mr. Berecz and others left the strong impression that they were relieved that Mr. Andropov had come to power, though no one said so directly. 'Thinks Before He Talks' 
''We ran the full text of Andropov's Nov. 22 speech,'' he said. ''In a way, it sounded like our speeches, and we think he is interested in reform. But of course one nation cannot copy another - he can't very well go to the Soviet public and say, 'Let's be like Hungary.' '' 
The thing about Mr. Andropov that most impresses Hungarians who know him is the quality of his mind. Mr. Berecz described him as a man ''who thinks before he talks.'' Andras Hegedus, the Stalinist Prime Minister of Hungary in 1955 and 1956, speaks of ''an open mind, intelligent and not merely clever.'' 
''We were Stalinist functionaries together,'' recalled Mr. Hegedus, who was trained as a sociologist. ''We traveled to villages and farms and factories, talking to peasants and workers about economic and social conditions. We sometimes went to Moscow on the same airplane. 
''He was different from most Soviet diplomats I have known. Most of them think they know everything after they have read the papers, and they stay in Budapest. Not Andropov. He had a real passion to learn and to know - to understand - this country, and he was even willing to learn some Hungarian so that he could probe more deeply. 
''Another point. His attitudes were clearly different from those of the Brezhnev generation. Like me, he grew up in postrevolutionary times. We shared a less doctrinaire approach to social problems. Once a much older Hungarian colleague and I were arguing in front of Andropov about the Marxist thesis that capitalism must end in absolute poverty. I insisted that the statistics didn't support the theory, and it was clear to me that Andropov agreed with what I said.'' An Unusual Promotion 
A Western diplomat who served in Budapest in the 1950's said he thought that Mr. Andropov's eagerness to explore the real conditions in Hungary was the key to his success in the months and years after the uprising. 
''When he came to Hungary, he was 40 years old, a junior functionary, not even a member of the Central Committee,'' said the diplomat, who is now living in retirement. ''Then he became Ambassador, which was in itself unusual, because few diplomats are ever promoted without changing posts. Then the country fell apart, which should have marked him for oblivion. Proc@onsuls who fail are usually marked for oblivion, like your Mr. Sullivan after the Iranian revolt. 
''Andropov kept on moving up. His big contribution - the thing that made his masters in Moscow respect him -must have been tough, accurate appraisals of the situation in Budapest. The key lesson of that episode is not the arrival of the Soviet tanks, which was obviously decided upon at a much higher level than the embassy, but what came after the tanks.'' 
Miklos Molnar, a leading Budapest journalist at the time, who now teaches and writes at a university in Switzerland, supports that view. During a long talk in his book-littered study in Geneva recently, Mr. Molnar said, ''Those of us who were following events intensively heard very little of him until almost the end of the uprising, because the big decisions were in the hands of much larger Soviet personalities - especially Mikoyan and Suslov, who came to Budapest often that autumn.'' Anastas I. Mikoyan later became Soviet President; Mikhail A. Suslov was the party ideologist. A View of Andropov's Function 
''I don't see a direct or demonstrable role for Andropov in deciding what to do about the uprising,'' Mr. Molnar added. ''He was not functioning as Moscow's gauleiter. He was the Kremlin's main source of information, but the policy was that of the Politburo.'' 
According to David Irving's book ''Uprising!'' published last year, Mr. Andropov had his doubts about the way the policy unfolded. Mr. Irving quoted Mr. Andropov as having told a group of aspiring diplomats in 1957, ''To blame the Hungarians themselves, let alone the Western powers, for the uprising, is not right.'' 
A minority view is that of Georg Heltai, then the Deputy Foreign Minister, now a history professor at the College of Charleston in South Carolina. While conceding that ''he was just a transmitter'' who had to ''clear with Moscow'' certain decisions, Mr. Heltai told the BBC recently: ''I'm sure that he had an absolutely free hand to deal with the revolutionaries, so the reign of terror in Hungary was the reign of terror of Yuri Andropov. It's bound to his name forever.'' 
The former Minister, who admired Mr. Andropov's coolness and his intelligence, said the Ambassador ''was the ultimate power who decided who and how many people should be executed.'' 'Rectify the Situation' 
Ivan Boldizsar, the editor of The New Hungarian Quarterly, used to meet Mr. Andropov at receptions and sometimes chatted with him in English. He put the matter of the Kadar succession much more bluntly. Mr. Andropov, he said, ''proved conclusively to Suslov and through Suslov to Khrushchev that the Soviet management of Hungary had been misguided and that Kadar could best rectify the situation.'' 
''In the end,'' Mr. Boldizsar said, ''Andropov was a hard-liner. After all, the Soviets came in and crushed the rebellion. But they didn't do it until Nov. 4, and the outcome was much better than it might have been otherwise.'' 
Mr. Vasarhelyi, the former Nagy press aide, says it is pointless to describe Mr. Andropov as a hard-liner or a soft-liner. ''I have no illusions about the man,'' he said. ''He spent 15 years as the head of the K.G.B. He has had a long and successful career in the party. He is a tough man, but he is a realist. One can speak to him, especially on the subject of Central and Eastern Europe. Unfortunately for us, Eastern Europe is the one area where the Russian ruling class, which certainly includes Andropov, cannot afford to yield anything. In Cambodia, on arms, even Afghanistan, yes, but we are their forecourt. One can only hope that Andropov's investment in Kadar over all these many years will give us a bit of protection.''