To the applause of a Democratic government in exile, former Secretary of State Edmund S. Muskie attacked President Reagan last night for what he portrayed as a wide range of global policy errors, but said he was "encouraged" that secretary-designate George P. Shultz may bring much-needed direction to the making of America's foreign policy.

After quoting the charge by former secretary of state Alexander M. Haig that the administration had shifted from its course of "consistency, clarity and steadiness of purpose," Muskie added:

"I could not have said it better myself. I might have been blunter: If we are not going to hell, then where the hell are we going, Mr. President?"

Muskie outlined his views to an appreciative dinner audience of the Center for National Policy, a think-tank organization whose list of officers reads like a listing of Who Was Who in the Carter administration, in which Muskie also served.

Four of the Democrats who have made clear their aspirations to be the party's 1984 presidential nominee also addressed the dinner.

Former Florida governor Reubin Askew talked of the need for the Democratic Party to appeal to "the vital central mainstream of American life," adding that the party must be willing to "risk losing votes to win lasting victories" for the American people.

Sen. Alan Cranston (Calif.) warned that relations between the United States and the Soviet Union are "dangerously deteriorating" and spoke of the need to ratify the SALT II treaty negotiated by President Carter.

Sen. Gary Hart (Colo.) praised Muskie, who was being given a public service award by the center, for having warned the party years ago that without "efficient government" its social goals would be "meaningless," adding: "If we'd listened then, we might not have lost some elections since."

Sen. Ernest Hollings (S.C.) praised Muskie, his predecessor as chairman of the Senate Budget Committee, for having given "credibility" to a budget process that he charged is "being adulterated by the Executive Branch."

Three other hopefuls were invited but did not speak. Sen. Edward M. Kennedy (Mass.), Democratic front-runner in the very early polls, worked the pre-dinner cocktail party, shaking hands and left.

Former vice president Walter Mondale never appeared. It was announced that he was out of town, but center officials said that Mondale had returned here and that they were surprised by his absence.

Sen. John Glenn (Ohio) had been expected to pilot his private plane from a speaking engagement in Detroit but did not arrive.

Other speakers included former party chairman Robert Strauss and the center's incoming chairman, Cyrus Vance, who had preceded Muskie as secretary of state.

Last night, Muskie characterized Vance's resignation as "an all-too-rare example in our system of a public servant who resigned--on grounds of principle--from high office."

He contrasted Vance's resignation with the recent resignation of Haig, who he said "cited no issue of principle, only a pervasive indictment that our highest policy makers had shifted" from their previously determined course of policy.

Muskie, who served as senator from Maine for nearly 22 years before becoming secretary of state, then delivered a region-by-region critique of the Reagan foreign policies. His litany included charges that Reagan has built his Soviet policies around "chest-beating rhetoric," brought the NATO alliance to a "major crisis," and that his early neglect of the Camp David accords contributed to the current crisis in the Mideast.

He said he was especially troubled by Reagan's policies toward the Soviet Union.

"When the president speaks about the Soviet Union, he reminds me of the Roman senator, Cato the Elder, who ended all of his speeches with the ringing injunction, 'Carthage must be destroyed!' "

But the Soviet Union cannot be eliminated, Muskie said, "nor can we compel their alien system to change its stripes, or to collapse, by any sudden and immense outpouring of public funds on defense spending--and by peddling arms indiscriminately."

Muskie attacked Reagan for "scuttling" the SALT II treaty that was negotiated by the Ford and Carter administrations, charging that Reagan's own offer for future arms reductions was "nothing more than a propaganda cover for an effort to 'win' the next round in the race."

But he went on to speak hopefully of the arrival of Shultz in the foreign policy-making process.

"I am encouraged by Mr. Shultz' testimony yesterday," Muskie said in his text last night. He cited Shultz' testimony at his confirmation hearings before the Senate Foreign Relations Committee: "An approach to the Soviet Union limited to the military dimension will not satisfy the American people. We must also make it clear that we are prepared to establish mutually beneficial and safer relationships on the basis of reciprocity."

Turning to Europe, Muskie charged that a "policy gap" is developing within the Atlantic alliance over how to deal with the Soviets.

"Historically, we have had our disagreements with the European allies in peripheral areas--Vietnam and the Middle East come to mind," he said. "But never before have our views been so divergent when considering policy toward our principal adversary."

In the Middle East, Muskie said, Reagan's "initial reluctance" to pursue vigorously the process for autonomy on the Israeli-occupied West Bank, as laid out in the Camp David accords, meant that "valuable months were lost and the initiative slipped from our grasp."

Muskie called on Israel to leave Lebanon "with all deliberate speed."