Edmund S. Muskie was confirmed by the Senate as secretary of state yesterday after stating his intention to play the central advisory and advocacy roles in a "positive diplomacy" for the United States.

The 94-to-2 Senate vote followed a three-hour Foreign Relations Committee hearing that was a senatorial sendoff for a popular and respected colleague, and a launching pad for some of his diplomatic ideas.

Muskie took the occasion to claim primacy among President Carter's foreign policy advisers, in the face of repeated senatorial criticism of presidential assistant Zbigniew Brzezinski.The incoming secretary of state said he clearly defined his intended central role "before the president and I entered into a contract" about the job.

An emotional farewell to the Senate, which had been his political home for 22 years, brought fellow lawmakers to their feet in applause just before the overwhelming vote of confidence. Among those joining the standing ovation was Sen. Jesse A. Helms (R-N.C.), who voted no because of his view that U.S. foreign policy has been "a disaster." The other negative vote was from Sen. Gordon Humphrey (R-N.H.).

The White House announced that Muskie will take the oath of office at 7:30 tonight in the East Room.

Admiring but direct questioning by his senatorial colleagues in the lengthy committee session brought the clearest expressions to date of Muskie's initial directions. Muskie said:

He hopes for "introductory talks" next week in Vienna with Soviet Foreign Minister Andrei A. Gromyko as a "constructive first step" toward repairing Soviet-American relations, but the burden of improvement is on the Soviets in present circumstances.

State Department sources said Gromyko agreed to the U.S. suggestion of a meeting presented to him in Moscow yesterday by Ambassador Thomas J. Watson Jr. The Vienna session may lead to a longer and more important Muskie-Gromyko meeting later, perhaps in June.

The United States should again explore essentially diplomatic means of obtaining the release of the American hostages in Iran through "a package of pressures" utilizing "the carrot-and-stick approach."

Muskie hinted broadly at a distaste for further U.S. military action against Iran, and promised that Congress will be consulted under the 1973 War Powers Act, for which he was floor leader, if military action is under consideration. Muskie presented a letter from the State Department officially pledging "the maximum possible cooperation" with Congress in decisions of war and peace.

The British proposal for a "neutral" Afghanistan after a Soviet withdrawal is "a useful idea" which the Soviets are unlikely to accept immediately, but which offers hope and food for thought. Muskie, saying that this was "my own reaction," was notably more positive toward the neutralization proposal than the Carter administration had been in the past.

In substance, Muskie's ideas seemed very much in the mold of his predecessor, Cyrus R. Vance, who resigned in disagreement with Carter's use of military forces in an attempt to rescue the hostages in Iran. Muskie paid tribute to Vance, who served as foreign policy adviser in the senator's ill-fated 1972 presidential bid.

In political standing, however, the differences with Vance were marked. As an elected leader in his own right, Muskie showed less reluctance than Vance to stake his claim publicly to the central role in foreign policymaking, and to comment on a broad range of controversial questions even before receiving detailed official briefings.

Muskie was prodded by several senators to take a strong hand against Brzezinski, who was described as causing confusion and damaged by his outspoken ways.

Sen. Joseph R. Biden Jr. (D-Del.) appealed to Muskie to "take advantage of the political trump card you have" in case of "inevitable" conflicts with Brzezinski. Biden recommended that Muskie bluntly inform the president of an intention to resign "if he doesn't back you up," adding that "you alone could bring him down for reelection" by such action.

Muskie replied cagily, "When I learn to say things like that diplomatically, I'll discuss them with you."

At another point, Chairman Frank Church (D-Idaho) decried the "public rivalry" between secretaries of state and White House national security advisers and said, "I think your political experience will prove helpful when it comes to the infighting," Muskie replied, "Even the outfighting."

According to the six-page prepared statement he read in steady, solemn tones, Muskie's priorities as secretary of state will be, in order of importance, to act as Carter's "principal adviser" on foreign policy, to be a very active "principal spokesman," to make sure that the State Department is fully engaged in the policymaking process, and to conduct U.S. diplomacy as much as possible through professional diplomats and ambassadors, limiting his own travel and personal role in negotiations.

Nevertheless, the newly installed secretary of state plans to spend most of next week out of the country, seeing foreign ministers of NATO allies in Brussels and Gromyko in Vienna. This is at a time when a major White House review of Iran policy, begun about 10 days ago, is expected to set new guidelines for U.S. action in the hostage crisis.It is unclear whether the policy review will be completed by the time Muskie leaves for Europe.

The 66-year-old Maine senator, backed up in the committee witness chair by his wife, Jane, and members of his family, staff aides and close friends, said he supports "the central elements of the foreign policy now in place." At the same time, he forecast that he will recommend to Carter "that we adjust some old policies and assert some new initiatives."

He volunteered that a rigorous attention to priorities is essential in his case because there are only a few months left in Carter's present term of office to "take control . . . make an impact" on foreign affairs.

A longstanding advocate of reduced tensions with the Soviet Union, Muskie said he had been "as shaken as the American people were" by the Soviet invasion of Afghanistan last Dec. 27, which "turned us 90 degrees . . . or perhaps 180 degrees" away from a policy of detente with Moscow.

Calling for "a firm and balanced policy toward the Soviet Union," Muskie said that "while aggression continues we must not relent in imposing a heavy price" on Moscow. At the same time he said that "as Soviet policies allow, we must never be blind to opportunities to work for peace."

A forceful advocate of the SALT II treaty during its consideration by the Foreign Relations Committee last year, Muskie said Senate ratification is "an impossibility at this point" due to the Soviet action in Afghanistan. He said it will be "very tricky" to abide by the negotiated but unratified terms of the agreement with the Soviets, but that this, in his judgment, is the wisest course so long as the Soviets are abiding by the same bargain.

On other subjects, Muskie gave no encouragement to normalization with Cuba under present circumstances, backed aid for the new Nicaraguan regime, endorsed movement toward democratic rule in the Philippines, and proposed that the United States try again to forge a closer relationship with Pakistan.