He is a hidden hand behind administration foreign policy and the most prominent survivor of a second-term staff shake-up that has brought new faces to President Reagan's White House.

He remains deliberately obscure, overshadowed by Secretary of State George P. Shultz and Defense Secretary Caspar W. Weinberger, but has made his mark with Reagan by helping to resolve many of the frequent policy disputes between the two strong-willed secretaries. His favorite mechanism for doing this is a private weekly breakfast at which the three officials, minus aides, reason together.

Robert Carl (Bud) McFarlane is a softspoken ex-Marine who as national security affairs adviser follows seemingly contradictory imperatives, guided by a view of Soviet power as grim and pervasive as that of the president.

A conciliator who values diplomatic endeavors, McFarlane nevertheless was the most persistent administration exponent of using U.S. military force in Lebanon. A Vietnam veteran who supported U.S. involvement there, he has come to believe that Americans will never back a long and limited war. A longtime advocate of offensive nuclear power and a chief player in preserving the MX missile, he has become an advocate of the Strategic Defense Initiative, the so-called "Star Wars" missile defense. Though a keen student of military affairs, he overestimated the effectiveness of the Lebanese army, which collapsed at a crucial point.

Working for a president who preaches Cabinet government but likes to make decisions in the closed company of a few advisers, McFarlane, 47, has quietly helped to centralize power in the White House. He drafted position papers and chaired working groups that helped produce a rare show of administration unity on arms control at last month's talks between Shultz and Soviet Foreign Minister Andrei A. Gromyko in Geneva. Reagan later called McFarlane's preparation for that "superb," according to White House spokesman Larry Speakes.

Administration insiders point to two sure signs of McFarlane's growing influence: he is to occupy the first-floor White House office of counselor Edwin Meese III after Meese's anticipated departure to become attorney general, and he has gained the valued approval of Nancy Reagan.

The first lady's social opinion of her husband's top aides is often an interestingly reliable barometer of their influence. At the annual New Year's Eve party at former ambassador Walter H. Annenberg's home in Palm Springs, Calif., recently, she made a point of going across the ballroom floor to praise his dancing.

Such incidents would never be related by McFarlane, a tight-lipped workaholic.

Administration officials say he is willing to sacrifice public image for private influence and to trade on the reputation he still holds at the Defense and State departments as an ideal staff man who poses no threat to Weinberger or Shultz.

Skeptics say McFarlane simply doesn't have the stature or presidential backing to challenge either secretary in a showdown.

McFarlane is aware, aides said, of Reagan's desire to have his Cabinet officers be policy spokesmen. He may be the only high-ranking administration official who practices the motto expressed by a sign on the president's desk: "There is no limit to what a man can do or where he can go if he doesn't mind who gets the credit."

McFarlane's expressionless manner has produced a public image of determined dullness that friends say shields a man who privately displays sharp wit and performs a near-perfect imitation of onetime boss Henry A. Kissinger. He uses the parody to remind hearers of the contrast between himself and the flamboyant intellectual who was President Richard M. Nixon's national security adviser.

One reporter described background briefings by McFarlane as given by "the man who wouldn't let you know if your suit was on fire." Baltimore Sun reporter Robert Timberg recently quoted New Right activist Paul M. Weyrich as saying of McFarlane: "He was created by God to disappear into crowds." Quiet Source of Power

Friends say he relishes his role as a quiet source of power, helping to provide a theoretical framework for a president who, like McFarlane, is determined to maintain U.S. military power. McFarlane wrote the celebrated passage into a Reagan speech March 23, 1983, calling for creation of what immediately was dubbed "Star Wars."

In an infrequent interview, McFarlane described his goals, saying:

"The world lives in the constant threat of nuclear annihilation. The president believes, and I have strongly urged that he pursue, a fundamentally different idea, and that is that you really can go to a defensive strategy. That would be an historic accomplishment if he were able to set that in motion. And that is probably the single greatest opportunity before us."

The interview in McFarlane's basement office in the White House is conducted under ground rules that permit no attribution without permission. McFarlane starts, as he often does, by sketching uses and limitations of U.S. military power in the 20th century, emphasizing what he sees as a two-century strain of national isolationism.

Though in the middle of what aides describe as a typical 17-hour day, he does not hurry the questioner or his answers.

McFarlane's friends and subordinates attest to his politeness and say he never shouts and rarely complains. He is described as loyal to friends and protective of his wife, Jonda, and their three children.

Much of McFarlane's humor is self-deprecatory: he likes to tell of the time a late-night television show producer told him he had "the most boring face" she had seen.

He is not above a barbed shot at his critics. Following the habits of a military career, he never criticizes his commander-in-chief. But he recently described Reagan's new director of communications, conservative former columnist Patrick J. Buchanan, as a "Jeane Kirpatrick in long pants."

After the November election, Kirkpatrick was the choice of conservatives, including Buchanan, to replace McFarlane when she asked to leave as U.N. ambassador. Instead, Reagan gave McFarlane a prompt and public vote of confidence. Kirkpatrick has returned to teaching.

In an administration that has raised internal feuding to a high art, McFarlane has collected an incongruous set of admirers, among them former secretary of state Alexander M. Haig Jr. and Treasury Secretary James A. Baker III, Haig's nemesis when Baker was White House chief of staff.

Haig said McFarlane has brought a needed "sense of order and professionalism to the foreign policy processes of the Reagan administration." But he warned that McFarlane will face public scrutiny and criticism now that he has shed his image as a junior staff man.

Kenneth M. Duberstein, former White House congressional liaison and Baker loyalist, said McFarlane has become "the honest broker of the administration, giving the president what he wants and needs in a national security adviser."

McFarlane, son of a New Deal Democratic congressman from Texas, also has the respect of many congressional Democrats.

Rep. Les Aspin (D-Wis.), new chairman of the House Armed Services Committee and an architect of congressional compromises that allowed limited production of the MX missile at the price of administration commitment to negotiate with the Soviet Union, credited McFarlane with "breaking the arms-control gridlock" because he understood House political realities.

Duberstein recalled a meeting with moderate Republican Sens. William S. Cohen (Maine), Warren B. Rudman (N.H.) and Slade Gorton (Wash.), who said the MX would never survive if viewed simply as "a Republican missile." From this meeting came a decision to consult McFarlane, then deputy to national security affairs adviser William P. Clark.

Out of the McFarlane-Duberstein consultations, which occurred as their bosses were feuding, arose the proposal for a bipartisan commission that would support the MX and arms control. Its chairman, suggested by McFarlane, was retired Air Force general Brent Scowcroft, for whom McFarlane worked when Scowcroft was national security adviser to President Gerald R. Ford.

More recently, McFarlane is credited with a White House decision to postpone submission to Congress of a Saudi Arabian arms package that might have resulted in an embarrassing foreign policy setback.

What happened, at a Jan. 23 meeting never publicly announced, is typical of the way McFarlane exercises his influence as an inside man.

According to administration officials, Weinberger ardently supported the Saudi arms sale with backing from high-ranking State Department officials friendly to the Saudis. McFarlane carefully prepared his opposition and came armed with information provided by congressional allies that the proposal faced tough sledding on Capitol Hill. He proposed instead delaying the sale and developing a comprehensive arms package for the Mideast, an idea that carried the day with Weinberger and Shultz.

"The White House saw this as a non-starter," a knowledgeable official said. "McFarlane convinced everyone there was no point to submitting something that the Congress wouldn't buy."

McFarlane did not come easily to influence in a post held by such dominant public figures as Kissinger and Zbigniew Brzezinski. Less than seven years ago, he was approaching retirement as a Marine lieutenant colonel and cheerfully acknowledged the military maxim that those of higher rank are more intelligent. He had not been totally disabused of this belief when he replaced Clark 16 months ago in a periodic White House shake-up. 'The Perfect No. 2 Man' ---

"He is the perfect No. 2 man or maybe No. 2 1/2," a White House insider said after McFarlane arrived there in 1981 as deputy to Clark, a longtime Reagan insider.

McFarlane's experience appeared to confirm this assessment. He was a military assistant to Kissinger in the mid-1970s and impressed his boss with his diligence. In 1976-77, he served as Scowcroft's staff man in the White House, and his low-visibility approach today is reminiscent of the approach used by Scowcroft, arbiter of disputes between the flamboyant Kissinger and a strong-willed defense secretary, James R. Schlesinger.

In both positions, McFarlane earned a reputation as a hard worker who made up for a supposed lack of conceptual brilliance with extraordinary preparation.

McFarlane joined the staff of the Senate Armed Services Committee, headed by then-Sen. John G. Tower (R-Tex.), now an administration arms-control negotiator. McFarlane played a role in decisions that led to committee rejection of SALT II, the arms treaty that President Jimmy Carter withdrew from Senate consideration after the Soviet invasion of Afghanistan in December 1979. When Haig became secretary of state, McFarlane became his counselor and trouble-shooter until he entered the White House as Clark's deputy.

Clark delegated by inclination and necessity because he had little background in foreign affairs, so McFarlane often became a sort of surrogate national security adviser who briefed his boss and the president and negotiated with Congress.

"If Bud had been a civilian instead of a military man, his experience would have seemed terrific," a current administration colleague said. "In fact, he has more experience and foreign policy knowledge than any other official in the administration, and he bears a greater burden than Scowcroft did because the president has no one around like Kissinger and Schlesinger."

Haig, who left the administration after clashes with White House officials and Cabinet colleagues, said he believes that McFarlane has restored professionalism to an office that had fallen into disrepute.

"Bud has provided a mandate of substance rather than populism," Haig said in an interview. "The secretary of state has been the spokesman, as he is supposed to be. The payoff is a consistency of policy and a degree of predictability that is stabilizing. The Soviets appreciate a tough, predictable, consistent set of policies."

These policies are based on a grim assessment of Soviet power, which, McFarlane wrote five years ago in the naval journal Proceedings, is capable of winning a "nuclear victory" not through war but by expanding its influence in Europe and the Third World as a result of achieving nuclear parity. McFarlane, concerned that the United States was turning inward after the Vietnam war, strongly criticized what he saw as U.S. strategic and political weakness since World War II.

"We must not allow bad policies to take on legitimacy simply because they were not accompanied by a holocaust," McFarlane wrote. "Having superior military might has provided an enormous hedge for flabby thinking. We could afford less-than-optimal strategic planning because push was never going to come to shove. We have had the luxury of being able to be foolish."

McFarlane, who served two combat tours in Vietnam, wrote that he saw the war there as a disaster in which the Soviets, without firing a shot, "watched while the United States was brought to its knees in a foreign war after an investment of more than $100 billion." But he continued to favor using the military to support diplomatic objectives, provided that its period of involvement was limited.

"I'd never now say that we should have sustained a conflict over five years," McFarlane told The Wall Street Journal last Monday. "Five years is simply incompatible with American values and the American attention span. The most relevant lesson I learned is what is and what isn't sustainable by the American people."

In 1983, as Clark's deputy, he was sent to Lebanon where he negotiated a critical cease-fire and became deeply immersed in that war-torn nation's politics of conflict.

McFarlane looked on the Lebanese situation as a textbook example of the low-order confrontations he had anticipated in his 1979 article. He saw the Soviets working through Syria and others to destabilize the Mideast, and he joined Shultz in advocating deployment of U.S. Marines to help shore up Amin Gemayel's shaky government.

McFarlane took over as national security adviser one week before the Marine headquarters compound in Beirut was demolished in a suicide truck-bombing in October 1983. More than 240 U.S. servicemen died, and Reagan's policy was also left in ruins.

In subsequent months, McFarlane sided with Shultz, favoring armed retaliation for the bombing and resisting withdrawal of U.S. forces from Lebanon. They lost on both counts to the combined opposition of Weinberger, the Joint Chiefs of Staff and public opinion as reflected through key Republican senators in conversations with Reagan. McFarlane never discussed the withdrawal publicly but confided to friends his bitterness about the Pentagon opposition to deployment.

"Our processes have failed," one official later quoted him as saying.

Siding with Shultz on Lebanon cast McFarlane for a time as an adversary to the Pentagon. On that issue, he was not a conciliator but an advocate who periodically gave optimistic assessments about the quality of the Lebanese army, which disintegrated at a crucial moment.

McFarlane suffered on other issues during his first months on the job, but from an excess of the self-effacement that ultimately would prove his greatest asset.

"One of Bud's adustments was the sudden leap," said a friend. "It was a fairly short time between when he was lieutenant colonel and national security adviser. It was a year or two before his talents could be realized and he recognized that deferential thinking no longer served his job. It speaks well he adjusted so quickly, but there was a period when self-deprecation and modesty got in his way."

McFarlane's qualities as a conciliator and his political understanding as much as his substantive background helped him make the adjustment in 1984.

Publicly, the administration had been embarrassed by several accounts of disarray that characterized arms-control processes during the first term. Frequent divisions between Shultz and Weinberger on a wide range of policy issues added to the impression of an administration that could not get toegther on foreign policy.

Reagan's political advisers also expressed anxiety privately, especially after the disclosure last April that the Central Intelligence Agency had directed the mining of Nicaraguan harbors. These advisers said they distrusted CIA Director William J. Casey and were worried that some agency adventure would put Reagan on the defensive during his reelection campaign.

But Baker, consistently at odds with Clark and Casey, had formed a close working relationship with McFarlane, who wound up meeting regularly with Casey and inviting him to periodic lunches with Shultz and Weinberger. Some thought that move would provide an early warning of surprises, but none materialized.

To defuse Shultz-Weinberger tensions, McFarlane began weekly breakfast meetings with them in which they could air grievances and make policy recommendations in confidence that what they said would never leave the room. 'Always Asking Good Questions'

A White House official described McFarlane as "using the Socratic technique of always asking good questions, never pushing" in meetings with Shultz and Weinberger and in National Security Council meetings where all are present. On many issues, this has produced compromise subsequently approved by Reagan.

Through this process and over time, McFarlane also overcame Pentagon suspicion that he was a mere handmaiden of Shultz. In fact, on "Star Wars" and Central America, McFarlane's position was much closer to that of the Pentagon than State, and he did not let his friendship with Shultz interfere with policy. An administration official who favors the "Stars Wars" plan credits McFarlane with converting a skeptical Shultz into a supporter

The plan, which has preoccupied Reagan, is the one issue that has built McFarlane's relationship with the president. McFarlane has regularly briefed reporters on the issue, emphasizing not the improbable dream of an "impenetrable shield," as does Reagan, but the value of a less-than-perfect missile defense as an element of deterrence.

As the revamped Reagan team starts the second term, no one is talking about McFarlane as a No. 2 man. But after Meese and deputy chief of staff Michael K. Deaver leave this spring, McFarlane will be the White House's ranking senior official.

New chief of staff Donald T. Regan has told McFarlane that he will not interfere with McFarlane's time with the president, which averages about four hours a week, considerably more than the amount Reagan spends with Shultz or Weinberger.

In recent months, a White House official said, McFarlane has become confident enough that he "feels free to tell bad jokes to the president." The joke to which the official referred was related by McFarlane during a planning meeting for this spring's Bonn economic summit.

It was about a cricket afraid he would be stepped on who asked an owl what he should do about it. The owl suggested that the cricket become an eagle. The cricket asked how he should make the change.

"That's logistics. I'm in planning," the owl replied. And so, at the White House, is McFarlane.