Behind the sudden resignation of Secretary of State Alexander M. Haig Jr. yesterday lay a long series of personality and policy conflicts that culminated in an administration decision to accept the resignation which Haig had threatened many times before.

The departure of Haig was discussed in the White House early in the week by administration officials who had known for two weeks that the secretary of state was talking about quitting--as he has done periodically since March, 1981, when Vice President Bush was put in charge of the White House crisis management group.

President Reagan formally decided to accept the resignation on Thursday and replace Haig with George P. Shultz.

"No one tried to talk Al out of resigning this time," said an administration official. "No one wanted to."

Haig submitted his resignation Thursday morning in a White House meeting with Reagan. According to associates, the secretary of state had become increasingly upset that the administration was speaking in too many voices, especially on the Middle East.

Haig had been warned on previous occasions that if he submitted his resignation, Reagan would accept it. But at the Thursday meeting, the president did not tell Haig what he was going to do. A Haig associate said that the secretary of state learned for the first time that his resignation had been accepted at mid-morning yesterday, at the end of a National Security Council meeting.

Officials said that Haig had engaged in a confrontation "with every major member of the administration." Ever since Reagan returned from Europe on June 11, this official said, Haig had outspokenly insisted that he wouldn't stay in the administration unless he remained the sole spokesman for administration foreign policy. Haig particularly resented what he considered attempts by other administration officials to undercut his strongly pro-Israel stance.

"I'm either going to run foreign policy or quit," Haig told White House aides on the plane returning from Europe.

The secretary of state complained of a series of slights on the 10-day trip, one of which was being relegated with his wife to the third helicopter while White House aides shared a helicopter with Reagan.

And Haig also was outspoken about a presidential decision on this trip--recommended by national security adviser William P. Clark-- which prevented him from going to Jerusalem at the height of the Israeli invasion of Lebanon. Haig was told blandly, according to officials, that special envoy Philip C. Habib was doing a fine job in the Middle East.

Haig was then allowed to announce that he had decided not to go to Jerusalem. But the decision rankled, according to some administration officials, and Haig complained about it.

He also complained that the special situation group headed by Bush was monitoring the Middle East situation, an action that Haig said was undercutting his own position.

The alienation of Haig from other members of the administration was further advertised on the European trip by the widely publicized difference between Haig and U.N. Ambassador Jeane J. Kirkpatrick over a resolution aimed at ending the fighting in the Falkland Islands.

Haig scornfully referred to Kirkpatrick as "a company commander," a reference which did not sit well with Reagan, who is known to be proud that he appointed Kirkpatrick, who is the only woman and only Democrat with cabinet status.

After Reagan returned from Europe the "slights"--and some policy differences--continued.

Haig, though forewarned, was irritated with the president's decision to expand the sanctions against the Soviet Union on the natural gas pipeline.

The decision was explained to Haig as a temporary one intended to put pressure on the Soviets to ease repression in Poland, but it was interpreted publicly as a victory for Haig's archfoe in the administration, Secretary of Defense Caspar W. Weinberger.

On Thursday, said officials, Haig became angry over a White House decision to have deputy press secretary Larry Speakes announce that Israeli Prime Minister Menachem Begin had promised that the Israeli army would not enter Beirut.

The White House point of view was that Haig refused to be the sort of harmonious team player Reagan prefers around him, instead favoring a confrontational style that was in vogue in the Nixon administration where Haig had served first under Henry A. Kissinger and then as a close presidential aide.

From Haig's point of view, the White House staff meddled in foreign affairs in which Haig considered the influential troika of chief of staff James A. Baker III, deputy chief of staff Michael K. Deaver and White House counselor Edwin Meese III to be ignorant.

"Weinberger drove him up the wall, the White House drove him up the wall," said an administration official in explaining Haig's action.

Haig was particularly upset with the ascension of Clark, who enjoys a close trusted relationship with the president formed in California when the national security adviser was executive assistant to Reagan during his first term as governor.

Originally, Clark was brought into the administration as deputy secretary of state with the express purpose of reducing the open friction between Haig and the White House staff.

He succeeded for a time, at least twice talking Haig out of offering his resignation directly to the president--as he did Thursday.

When Clark came over to the White House at the beginning of the year replacing national security adviser Richard V. Allen, some White House officials predicted that it would be only a matter of time before Haig blew up and left.

Though Haig continued to prevail on most policy decisions after Clark came over to the White House, he became more isolated within the administration and more conscious that he was viewed as a confrontational outsider by the close-knit White House staff.

White House staff members had hoped privately that what some of them regarded as Haig's inevitable resignation could be postponed until after the 1982 elections. This also was the president's expectation, one of these staff members said yesterday.

But it became increasingly clear in the last few weeks that Haig was not about to be mollified.

"He made no bones about it; he was always threatening to quit," said an official yesterday.

There was never a question about firing Haig, or asking for his resignation, said an administration official.

"The resignation was always there if the president wanted it," said an official. "The trick was to keep Al from quitting, not to force him to resign."

A State Department associate of Haig said that the secretary of state at first was happy over Clark's performance at the National Security Council because the operation was improved and Haig had more control over policy matters.

"Then in the last three months he Haig saw the process as an obstacle," this associate said. "He found that the solution was the problem."

U.S. difficulty in restraining the Israelis compounded the problems between Haig and the White House staff. Haig particularly resented Bush's situation group and the sending of Weinberger and Bush to the funeral of Saudi King Khalid.

As Haig saw it, according to this associate, the Arabs were "getting the signal that we would restrain the Israelis and the PLO Palestine Liberation Organization could play it out."

But both at the White House and the Pentagon there was a growing view that Haig had overreached himself in the Middle East.

"The Israelis used him coolly, telling him time after time that they would do certain things and then not do them," said a Pentagon official. "Then he would rationalize their acts afterward."

The secretary of state at first accepted Israeli statements of limited objectives in clearing out southern Lebanon, then was forced to revise and re-revise his forecasts.

As the Israelis advanced, the misgivings grew in the White House, though the policy Haig advocated continued to be followed for the most part by Reagan.

While Reagan has been supportive of Israel since the creation of the Israeli state in 1948, the president privately expressed concern over the mounting toll of civilian casualties in Lebanon. And the White House staff, and especially Weinberger, were concerned about appearing to be overly hospitable to Begin, as some officials believed Haig to be during the Israeli leader's visit to Washington last week.

The extent of Reagan's actual involvement in the decision to finally accept Haig's resignation was not known.

It was learned that the idea of letting Haig go was first discussed among a small inner circle of the staff, which had learned that Haig was once more threatening to quit.

Reagan, who had earlier in the year expressed the view that he hoped he could avoid major Cabinet changes until after the election, apparently was persuaded to accept Haig's resignation in a private meeting Thursday.

Because of the many struggles between Haig and other members of the administration, announcement of the decision yesterday was greeted with a curious sense of relief both at the White House and the State Department.

Characterizing Haig's demeanor yesterday, a State Department associate said: "I think he feels that he has a burden lifted from him--it doesn't mean that he is overjoyed. I think he feels that he's got his dignity, which he surely has."

And at the White House, one official said: "It's finally over after 18 months of tension."

White House officials insisted to reporters that the change would make no difference in U.S. foreign policy.

Privately, however, there was concern at various levels of the staff that the Haig resignation would lead to a round of recriminations and examinations of U.S. foreign policy, with an emphasis on drift and divisions.

The timing of the change, acknowledged one official, was "unfortunate." Another official said that Reagan was "dismayed," though not surprised.

The decision to accept Haig's resignation was closely held in the White House. It was kept from key officials in the communications and press office until late yesterday.

The decision apparently was withheld because top-ranking officials wanted to be sure that Shultz had agreed to be Haig's replacement before they shared the news.

White House strategy was, in the words of one official, to try to "focus the attention on Shultz" rather than on the reasons Haig had left. This strategy didn't work, an administration official acknowledged late in the day.

"What people are interested in is Al Haig," he said.