W. Averell Harriman, 94, whose service to the nation in peace and war was unique in its breadth and longevity, died yesterday at his house in Yorktown Heights, N.Y., of kidney failure and pneumonia.

For half a century, as the agent of presidents or as elder statesman, Mr. Harriman was at the center of efforts to establish practical working relations between the United States and the Soviet Union.

He was one of the first to warn of the dangers of Soviet expansion at the end of World War II, and later he was one of the first to champion reduced tension between the two superpowers in order to avert World War III. That brought him under political attack first as a war hawk, then as a naive dove, but his objectives never changed.

In 1963 he negotiated the first major arms control pact between the United States and the Soviet Union, the Limited Test Ban Treaty, prohibiting nuclear weapons tests in the atmosphere, in outer space and under water.

The offices he held ranged from ambassador to Moscow and London to secretary of Commerce, governor of New York, undersecretary of State, and negotiator on wars in Laos and Vietnam. Above all, he was a matchless behind-the-scenes envoy, ready to circle the globe for Franklin D. Roosevelt, Harry Truman, John F. Kennedy, Lyndon B. Johnson or any other president who asked him.

When they ceased asking, Mr. Harriman went on his own. In June 1983, when he was 91, with sight, hearing and voice all failing, but with his determination undiminished, he made his last mission to Moscow, to meet with Soviet leader Yuri V. Andropov. He was driven to that journey by apprehension over the great gulf between the men in the Kremlin and the Reagan administration.

Mr. Harriman outlived Andropov and his immediate successor, Konstantin Chernenko, as he outlived their predecessors, Josef Stalin, Nikita S. Khrushchev and Leonid I. Brezhnev, with whom he had dealt through four decades of highs and lows in American-Soviet wartime collaboration, cold war and elusive detente.

As close friends knew, Mr. Harriman for 10 days had been gravely ill at his home, Birchgrove, in the New York City suburb. With him in his final days were his wife Pamela, an eminent Democratic Party figure in her own right and former daughter-in-law of Winston Churchill, and his daughters from his first marriage, Mary Fisk and Kathleen Mortimer. He also had six grandchildren and six great-grandchildren. One of his last visitors was step-son Winston S. Churchill II, grandson of the legendary British leader.

Funeral services will be held at St. Thomas Church in New York City at noon Tuesday. Burial will be private at his family estate in Harriman, N.Y. A memorial service will be held at noon Sept. 16, at the Washington Cathedral here.

From around the globe, leaders, associates and friends, including political adversaries diametrically opposed to his concepts of dealing with the Soviet Union, paid homage. One of the latter was President Reagan.

"The world has lost one of her most respected statesmen," Reagan said in a statement. "The death of Averell Harriman closes a chapter in diplomatic history which only someone of his talent and stature could have written.

"On behalf of my predecessors who he served with such loyalty and dedication," the president said, "I join all who mourn his passing."

The State Department called Mr. Harriman "one of the most distinguished statesmen of the 20th century."

Secretary of State George P. Shultz and Mrs. Shultz expressed personal condolences to the Harriman family, along with "thousands of State Department and Foreign Service personnel . . . who had the honor of knowing and working with Ambassador Harriman."

Dean Rusk, secretary of State for Presidents Kennedy and Johnson, said that "he was one of the finest diplomats this country has had in the entire postwar period. One cannot grieve after a life so long and so nobly led." Cyrus R. Vance, secretary of State under President Carter, a close personal friend of Mr. Harriman's and his deputy in the Vietnam peace talks, said he "was extraordinary for what he did for his country" and "we will all miss him terribly."

Sen. Edward M. Kennedy (D-Mass.) said, "I remember when my brother Jack first became president, he announced that the torch had passed to a new generation of Americans. Then he turned around and realized that Averell Harriman still had it."

Gov. Mario Cuomo of New York called Harriman "one of the great governors" of the state, remembered for an administration "deeply concerned with the problems of mental health, civil rights and aging." New York City Mayor Edward I. Koch ordered all city flags flown at half staff.

From Moscow, the Soviet news agency Tass, in reporting Mr. Harriman 's death, said that he "declared for the development of mutual understanding" between the two superpowers and "called for arresting the arms race." In Moscow's May 1985 40th anniversary celebration of the defeat of Nazi Germany, Mr. Harriman was honored for "profound personal contribution" to the wartime alliance of the United States and the Soviet Union.

In October 1982, at the dedication of the W. Averell Harriman Institute for Advanced Study at Columbia University, which he launched with a $10 million endowment, Mr. Harriman deplored "so much misinformation" about the Soviet Union circulating in the United States, "beginning with those in the highest authority of government."

"In looking back over my experience of some fifty years with the Soviet Union," he wrote in 1975 in the foreword to his partial memoirs, "Special Envoy to Churchill and Stalin, 1941-1946," "I find that my basic judgments remain little altered, although conditions have changed radically.

"I have been attacked for those judgments from both ends of the political spectrum. Some have called me a warmonger; others denounced me as too soft on communism. I continue to maintain, as in 1945, that in ideology there is no prospect of compromise between the Kremlin and ourselves, but that we must find ways to settle as many areas of conflict as possible in order to live together on this small planet without war."

The key to understanding, he was convinced, was deeper knowledge of the two systems and their overlapping, and conflicting, interests.

His experience with the Soviet Union went back almost to its beginnings. He missed meeting Lenin, but not Leon Trotsky, whose "coldness" during a four-hour business meeting, Mr. Harriman later concluded, "may have been due to his difficult situation at the time" -- 1926. Trotsky by then had lost his power struggle with Stalin and was headed for exile and assassination.

Mr. Harriman, then 35, had gone to the Soviet Union to inspect a manganese mining concession in the Caucasus Mountains in which he and other Americans had invested. He left the Soviet Union convinced that Lenin's revolution was "not 'the wave of the future,' " and wrote in 1970: "Nothing has happened since to alter my conviction that the Bolshevik Revolution, for all its manifest achievements, has been on balance a tragic step backward in human development." But, he concluded, "for better or worse, the Soviet regime was here to stay."

That early encounter with the Soviet system gave the young Harriman an invaluable cachet for dealing with its leaders in subsequent decades. To them, the patrician Mr. Harriman, the scion of one of America's wealthiest industrial families, was the stereotype of capitalism. While that made him the archenemy ideologically, in pragmatic power terms the Soviet leadership saw him as a select member of the inner circle controlling the United States, with the influence to deliver what he promised to a far greater degree than any professional diplomat.

And yet, he was never a dramatic public figure on the order of Henry Kissinger, nor was he a great scholar or a masterful politician. His strongest qualities were the ability to drive to the core of an issue and enunciate it simply, while clinging to his own convictions tenaciously.

Admirers, and critics, tried various labels to describe the Harriman style: "Honest Ave the Hairsplitter" for resourcefully marshaling technicalities to reinforce his arguments; "Available Ave" for his readiness to dash around the world at a president's signal, and above all, "The Crocodile," for striking out unexpectedly to chop off an opponent's muddled argument.

There are competing versions about who first bestowed that lasting sobriquet. At a lavish 90th birthday party in Washington, which his equally energetic wife, Pamela, combined into a lucrative fund-raiser for her political action committee, "Democrats for the '80s," Sen. Edward Kennedy credited the appellation to his brother, the late president.

At a White House meeting, as the senator recounted it, both the president and Mr. Harriman, then a mere assistant secretary of State, began speaking at the same time. Mr. Harriman, whose hearing aid often failed, kept talking, unaware that he had eclipsed the chief executive. The president, when asked later by an anxious aide whether he had been annoyed, replied: "Of course not. I enjoy watching Averell in a meeting more than anyone else. He sits there with his head down and you might think he's asleep. But then someone says something foolish, and he bites his head off with a snap, like a crocodile."

It was crucial to know when to snap, and when to swallow hard, at the level where a middle-aged Harriman made his first high marks, during World War II, learning from such artful practitioners as Roosevelt, Churchill and Stalin.

By then he had a sensitive feel for the roots of power, perhaps initially absorbed from his railroad tycoon father.

His stature in banking and industry gave him easy entry to government at the age of 42, when he agreed in 1933 to serve on the Business Advisory Council created by Roosevelt to mobilize support for the National Recovery Program.

He had defected earlier from Republicanism to become a Democrat. However, actually working with the New Deal, as New York state chairman of the National Recovery Administration, while board chairman of a major railroad and an international banker, was totally beyond the pale in his class.

"The hate-Roosevelt sentiment ran strong," he recalled. "When I walked down Wall Street, men I had known all my life crossed to the other side so they would not have to shake my hand."

The Harriman willingness to take on lofty or mundane assignments gave him an exceptional mixture of experiences. His major posts were: chief of the materials branch, Office of Production Management, 1940-41; special representative of the president in London for lend-lease and other wartime agencies, plus special missions to the U.S.S.R., 1941-43; ambassador to the Soviet Union, 1943-46; ambassador to Britain, 1946; secretary of Commerce, 1946-48; U.S. ambassador in Europe for the Marshall Plan, 1948-50; special assistant to the president, 1950-51; director, Mutual Security Agency, 1951-52; governor of New York, 1955-58; ambassador-at-large, 1961, and again in 1965-68; assistant secretary of State for Far Eastern affairs, 1961-63; undersecretary of State for political affairs, 1963-65; delegation chief, Vietnam negotiations in Paris, 1968-69; and chairman, foreign policy task force, advisory council, Democratic National Committee, for several years beginning in 1974.

Of all these titles he prized above all that of "governor," his one high elective office. When he won that post, even many ardent admirers thought it improbable that Mr. Harriman, with his shuffling, noncharismatic style, would defeat Republican Sen. Irving M. Ives, although he had overtaken Franklin D. Roosevelt Jr. in the Democratic primary. He was defeated in his reelection bid by Nelson A. Rockefeller.

Two offices held by John Quincy Adams, however, did elude Mr. Harriman: secretary of State and the presidency, but not for want of zeal. In 1952, and more determinedly in 1956, Mr. Harriman sought the presidential nomination, which each time went to Adlai E. Stevenson.

The Harriman family background suggests why he might have felt driven to prove himself in public service.

His father was Edward Henry Harriman, the son of an Episcopal clergyman without wealth, who catapulted into Wall Street as the "Little Giant." When the elder Harriman died in 1909, his holdings included dominant interests in 75,000 miles of railroads, including the Union Pacific, and dozens of corporations.

He yearned for public recognition and instead was listed by Theodore Roosevelt among the "malefactors of great wealth." That malediction may have registered especially on William Averell, one of two sons and three daughters, who was born in New York City on Nov. 15, 1891.

Young Harriman, with a share in a $100 million estate, was raised in a baronial environment of summer and winter homes that included a 100-room mansion at Arden, N.Y., serviced by the villages of Arden and Harriman.

He was educated at Groton and Yale. At Yale, where he was a versatile athlete, young Harriman, as varsity crew coach, helped select a freshman crew coach named Dean Acheson, who later outdistanced him as secretary of State.

After Yale, Mr. Harriman went to work for Union Pacific, soon claiming a vice presidency there and later becoming chairman of the board, as well as executive committee chairman of the Illinois Central Railroad Co.

He tried unsuccessfully to duplicate in shipping and aviation his father's success in railroads. In 1920, he organized W.A. Harriman & Co., which later evolved, through a merger, into the banking firm of Brown Brothers, Harriman & Co.

Even while helping the New Deal, he was alert to his business interests. In the late 1930s, he developed Sun Valley, Idaho, as a world-class ski resort as a means of expanding his railroad's business. He was first in the nation to order all-aluminum streamliner trains.

In his younger years, he was a champion eight-goal polo player, an expert skier, and a member of the trans-Atlantic social set. But even before the stock market crash in 1929, he became disaffected with the political attitudes of his super-rich friends. In 1928, he switched his political allegiance to the Democrats' Alfred E. Smith.

That shift carried Mr. Harriman into a modest supporting role in 1932 for old family friend, Franklin D. Roosevelt.

In Washington, in the early Roosevelt days, it was Harry Hopkins, the president's powerful adviser, who became Mr. Harriman's patron. Later it was said that Mr. Harriman became to Hopkins what Hopkins was to Roosevelt: friend, confidant and official agent. Hopkins had ready access to the strings of government; Mr. Harriman had ready access to the highest social and business circles.

In time, Mr. Harriman and Roosevelt, with the natural affinity of country squires, and, in the eyes of the wealthiest Republicans, "traitors to their class," established their own trusting relationship.

Hopkins took Mr. Harriman out of the Office of Production Management in March 1941 and sent him to London, Moscow and other war fronts as the president's special representative.

He attended the Atlantic Charter meeting between Roosevelt and Churchill in 1941, and all but one of the major World War II conferences. He was with Churchill and Stalin in Moscow in 1942; with Roosevelt and Churchill at Casablanca in 1943; with Roosevelt, Churchill and China's Chiang Kai-shek at Cairo in 1943, and the same year with the western Big Two and Stalin at Tehran; with Stalin, Churchill and Anthony Eden in Moscow in 1944; at Yalta in 1945, and at Potsdam that year with President Truman, after Roosevelt's death.

After Germany attacked the Soviet Union at the end of June 1941, Hopkins was sent on the first mission by Roosevelt to explore Stalin's military requirements, followed by Britain's Lord Beaverbrook and Mr. Harriman, who reached Moscow when the Nazi advance was threatening the Soviet capital.

One of the most perceptive accounts of Mr. Harriman's later service as ambassador to Moscow was written by George F. Kennan, author of the original U.S. "containment" strategy who served as Mr. Harriman's "No. 2" man. In "Memoirs: 1925-1950," Kennan wrote:

"He Ambassador Harriman had no interest in the social-representational side of the diplomatic function -- either his or ours. He had that curious contempt for elegance that only the wealthy can normally afford . . . . Unique in his single-mindedness of purpose, it was his nature to pursue only one interest at a time with a dedication, a persistence and an unflagging energy and attention that has no parallel in my experience . . . .

"His physical frame, spare and sometimes ailing, seemed at best an unwelcome irrelevance; I had the impression that it was with an angry impatience that he dragged it with him on his daily rounds of duty, and forced it to support him where continuation without its support was not possible . . . . He worked 18 to 20 hours a day. No detail was too small to escape his attention. He wanted to know everything about everything . . . .

"He didn't shout you down, for he never shouted; but he had a way of riding roughshod over unsolicited suggestions. A hundred times I came away from our common labors asking myself, without finding an answer: 'Why do I still like this man?' "

Kennan's answer: "His integrity in the performance of his duties was monumental and unchallengeable."

Mr. Harriman reported that Stalin bluntly told him in October 1945, as the wartime victory was achieved, that "we've decided to go our own way." After having been one of the most energetic advocates of wartime aid to Russia, Mr. Harriman had sounded the alarm in Washington as early as Sept. 9, 1944. He cabled that the Soviet leaders "have misinterpreted our general attitude toward them as an acceptance of their policies and a sign of weakness . . . . There is every indication that unless we take issue with the present policy the Soviet Union will become a world bully wherever their interests are involved."

In March 1948, on his return from Moscow, Mr. Harriman was asked if he thought war with the Soviets was inevitable. "I most certainly do not," he replied, "but it depends primarily on us. There will be no war if we, as a country, remain strong, physically and spiritually." He told the Senate Foreign Relations Committee that "Russia does not want war, especially with the United States. However, that doesn't mean that war can be averted" if the Soviet Union overreaches.

His subsequent service as ambassador to London was a brief six months, with President Truman recalling him to replace Henry A. Wallace as secretary of Commerce after Wallace publicly opposed any "get tough with Russia" policy as pandering to "British imperialism."

In succeeding years, as Mr. Harriman supported the creation of the North Atlantic Treaty Organization and became the European director of the Marshall Plan, it was his turn to be denounced by Moscow as a "warmonger" and agent of "American imperialism."

In 1950 and 1951, Mr. Harriman was Truman's special adviser on foreign affairs. One of his tasks was to accompany the president to Wake Island to parley with imperious Gen. Douglas MacArthur. When Truman dismissed MacArthur for insubordination, part of the Republican wrath broke over Mr. Harriman's head in the resulting Senate inquiry. There were angry charges, which Mr. Harriman adamantly denied, that Roosevelt and his subordinates were duped into a "sellout" of vital Western interests at Yalta.

The Yalta furor recurred again in 1955 when Secretary of State John Foster Dulles released the secret record. That record substantiated Mr. Harriman's personal firmness, showing that when Soviet Foreign Minister Molotov requested a $6 billion, 30-year loan, Mr. Harriman recommended to Roosevelt that it be tied to the Soviet Union's international behavior.

Mr. Harriman's readiness to search for easement of East-West confrontation after Stalin led him to see both opportunities and dangers in the transition to Khrushchev's more venturesome leadership. In 1959, in a brief book entitled "Peace With Russia?" based on talks with Khrushchev in the Soviet Union, Mr. Harriman advocated "all-out competitive coexistence" with communism.

With the election of President Kennedy, Mr. Harriman gained an opportunity to explore his theses, starting with Laos, from his new post of assistant secretary of State for Far Eastern affairs.

For 15 months, in 1961 and 1962, Mr. Harriman negotiated intensively at a 14-nation conference in Geneva, and in shuttle trips to Southeast Asia, to achieve an agreement on Laotian neutrality. It was never put into effect because North Vietnam never withdrew its forces from Laos. What the United States gained was alignment with Premier Souvanna Phouma as the "neutralist" leader of the country.

Next came an opportunity that followed the flare-up in U.S.-Soviet relations over Berlin in 1961 and the Cuban nuclear missile confrontation of October 1962. This was the major East-West agreement in the post-war era, the U.S.-Soviet nuclear test ban treaty prohibiting above-ground nuclear explosions. Mr. Harriman headed the U.S. negotiators in Moscow.

From 1963 to Jan. 20, 1969, when he left office with the Johnson administration, the Vietnam War was the preoccupying, frustrating subject for Mr. Harriman.

As a senior State Department official, he shared responsibility for clearing a disputed August 1963 cable that is blamed or praised, as the case may be, for helping to encourage the overthrow of South Vietnamese President Ngo Dinh Diem in November 1963.

In early 1965, Mr. Harriman, then a roving ambassador for President Johnson, was charged with probing for a peaceful solution of the war. But controlling strategy for war and peace was tightly held by the president and Secretary of State Rusk.

When United States-North Vietnamese peace talks finally did begin in Paris in May 1968, following a partial halt in the bombing of North Vietnam, Mr. Harriman led the American delegation. He was determined to negotiate an end to what he regarded as a war long past justification in its costs to the United States.

In secret negotiations, with the Russians operating as intermediaries, Mr. Harriman was obliged to bargain with his less conciliatory supporters in Washington, as well as with the unyielding South Vietnamese, plus the North Vietnamese adversaries. When a breakthrough with the North Vietnamese finally was achieved, Saigon balked.

South Vietnam succeeded in stretching the formal start of the new talks into the Nixon administration. Said Ambassador Harriman: "We were aghast in Paris."

Mr. Harriman carried with him into private life his determined activism. In lectures and speeches and as chairman of the Democratic Policy Committee's International Affairs Committee, he deplored the continuing Indochina war as "a national tragedy."

Inevitably, he came under political counterattack. The blows were sharp, and also sometimes low. Vice President Agnew charged that "Harriman's penchant for trusting communists has cost some people their freedom and others their lives."

Mr. Harriman was in no way deflected by Agnew. Indeed, by 1971 the Washington establishment had become so accustomed to his durability that there was comparatively little surprise when, at the age of 79, he married his third wife, Pamela Digby Churchill Hayward, then 51. (His wife of 40 years, the former Marie Norton Whitney, died in September 1970. An earlier marriage to Kitty Lanier Lawrence, with whom he had two daughters, ended in divorce in 1929.)

The Harrimans' Georgetown home, with its terraced garden and adjoining offices, became a social and political center for Democratic leaders, aspirants to office, distinguished foreign visitors and Mr. Harriman's many journalist friends. On occasion, it even served as temporary living quarters for newly appointed officials.

There were no further full-time official posts for Mr. Harriman. But he continued to be very much engaged, speaking out, testifying before Congress, on his great store of experience, occasionally going abroad on ceremonial missions for the White House, or visiting Soviet leaders.

President Carter, in his memoirs, wrote: "Before leaving for the Vienna summit with Brezhnev, in 1979 I had a long talk with Governor Averell Harriman, who in his long diplomatic career had learned as much as anyone about the Soviet leaders. I took careful notes on his advice."

Just before dedicating the institute at Columbia University that bears his name, Mr. Harriman told this reporter there were many illusions about the extent of his wealth. "I didn't inherit vast sums" on the scale that many assume, he said. His father, he said, left his mother "about $70 million" a huge inheritance in 1909 but "she gave a great deal of money away." His mother's estate was divided among three daughters and two sons, with Averell and his brother, Roland, receiving the larger amounts. His $10 million gift to Columbia, he said, was "a substantial sum" of the remainder.

Mr. Harriman was noted for his driving demands on associates, who found that his energy almost always exceeded theirs, whatever their age.

He also could be the gentlest of men. A State Department colleague recalled that once, on a typically grueling Harriman trip, "there we were, flying over the Black Sea and everyone asleep. Then here comes the old man, in his robe, tip-toeing up and down the aisle of the plane putting blankets over everyone like a father taking care of his children."

That was the soft underbelly of "The Crocodile."