In an important victory for President Carter, the long-stalled natural gas pricing bill has been approved by a majority of House-Senate energy conferees and cleared for final congressional action.

After eight months of negotiations, two months of drafting language and three weeks of haggling over the fine print, the multibillion-dollar compromise to end federal price controls on newly discovered natural gas by 1985 was finally nailed down at the White House after President Carter met Thursday evening with two Republican senators and two Democratic House members.

The required majority of 13 House conferees' singnatures was obtained when Reps. James C. Corman (D-Calif.) and Charles B. Rangel (D-N.Y.), who had opposed it, agreed to sign. Sens. Pete V. Domenici (R-N.M.) and James A. McClure (R-Idaho) signed to provide a majority of Senate conferees.

Dissenting House liberals had complained earlier that the gas bill was too great a price increase to impose on consumers. But Corman and Rangel were won over after a series of appeals, from not only the president and speaker of the house, but also the chairman of the Federal Reserve Board and the secretary of the treasury, who told them the very value of the dollar might hinge on their decision.

The two senators were apparently won over by more orthodox means. McClure said yesterday night discussions, the senator plainly regarded as major concessions on breeder reactors, which in the past Carter has opposed.

Carter hailed this as a "major step forward" toward development of a national energy policy. Secretary of Energy James R. Schlesinger Jr. said the agreement, if approved by Senate and House, would save the equivalent of up to 1 million barrels of imported oil a day by producing that much more gas.

Congressional approval would end a 24-year battle over price controls versus deregulation. A major part of Carter's energy bill, which has been stuck in Congress for 16 months, would have continued controls and extended regulation to intrastate gas consumed where produced. The House backed Carter, but the Senate voted deregulation and conferees have been seeking a compromise since last fall.

Sen Henry M. Jackson (D-Wash.), who led the long search for an agreement said the bill will be taken up first in the Senate, possibly next week but more likely after Labor Day. He said the Senate vote will be very close, and warned that if Congress rejects the compromise there won't be another gas bill next year.

"We can't go through this kind of trauma that has lasted more than a year again," he said. Some opponents of the compromise say they believe that if it is rejected Congress next year would vote immediate deregulation.

The compromise is opposed by some liberals who think it gives too much to producers and by some conservatives because it doesn't deregulate quickly enough. Many producers, as well as consumer and labor groups, oppose it.

Schlesinger said the compromise would cost consumers no more than $4 billion in added costs by 1985 and possibly less than under present law. Consumer group opponents contend that it could add $50 billion to producer revenues in seven years.

Jackson, who had fought against deregulation for a quarter of a century in the Senate, said the compromise has the virtue of ending the danger of shortages in northern consumer states by ending the dual price system and moving gas from the glutted interstate market to interstate customers.

The compromise probably faces a filibuster in the Senate. Jackson predicted that the needed 60 votes could be found to stop a filibuster, but wasn't as certain that a majority of 51 would vote to pass it. Some senators don't want to kill it by filibuster, he said.

The bill appeared dead for lack of conference signatures on the report until late Thursday evening.

Corman had opposed the compromise because he said he felt it should not be enacted unless the domestic crude oil tax, which Carter calls the centerpiece of his energy program, passed too. The oil tax now appears dead.

Rangel said he couldn't see what lifting price controls could do to help his constituents.

On Wednesday, Secretary of Treasury W. Michael Blumenthal and G. William Miller, chairman of the Federal Reserve Board, met with Corman, Rangel and other conferees and apparently made a profound impact with warnings about the dire impact on the American economy if action is not taken to shore up the value of the dollar abroad.

Carter and his fiscal advisers have repeatedly said enactment of an energy bill would be one of the best ways to do that.

Corman and Rangel went to House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) Thursday afternoon and reportedly said they were ready to sign the conference report if they were assured that would produce a majority.

The two congressmen went to the White House at 7:30 p.m., just after the president had met for about half an hour with Domenici and McClure.

The senators signed the conference agreement, providing a majority of nine Senate conferees.

Only 10 of the required 13 House conferees had signed. But Rep. Charles Wilson (D-Tex.) had left his signature on a blank piece of paper, saying that if 12 others signed the speaker could paste Wilson's signature onto the conference report. Though he was hesitant about being the only gas producer representative to sign, Wilson said he did not want to be the one who denied Congress a vote on the compromise.

Corman and Rangel left their signatures for use if Wilson signed. Wilson was on an airplane to Texas after leaving the message to use his signature if 12 others signed. It wasn't until nearly midnight, after Wilson landed in Texas and was reached by telephone from the White House, that it finally was all put together.

The gas bill had appeared lost Thursday after two conferees who had approved the agreement in principel in May - Reps. Joe D. Waggonner (D-La.) and Henry S. Reuss (D-Wis.) backed off and refused to sign. Waggonner considered it antiproducer; Reuss, anticonsumer.

Corman said yesterday in a telephone interview from California that he and Rangel won a "strong commitment" from Carter not to raise U.S. oil prices to work levels by executive action of gradual decontrol a some oil industry lobbyists are now advocating. Carter's proposal to raise the price to world levels by a tax would have refunded the proceeds to the public.

Corman said he doesn't understand all the fine points of the bill, but decided it would be better for Carter to move the bill with liberal support - instead of caving in to demands of producer-state legislators to get their support. Schlesinger said Corman agreed to give his support two weeks ago.

Corman said Blumenthal and Miller were "very persuasive." Another reason he changed position, he said, was that he was persuaded that the crude oil tax is now dead and that the gas bill would be a step forward.

Corman was heavily lobbyed against the gas compromise by the International Association of Machinists, which forms a sizable part of his constituency as aerospace workers. "The machinists have been the best friends I've got at home. I hope we'll still be friends," Corman said.

He said there were no deals involved in getting his vote. Carter agreed that there were no deals.

Domenici said he went to the White House because he wanted to hear the president say that he whole-heartedly supported the bill and would work for it. The president said that, he said.

McCluer issued a statement indicating that he and Carter had worked out an accommodation on the breeder-reactor program which Carter has opposed as part of his non-proliferation policys' but which McClure wants to push forward. The public works appropriation bill contains funds Carter doesn't want to continue work on the Clinch River breeder reactor in Tennessee.

McClure said he had reached an agreement in principle with the president to "establish the basis' for a breeder program. McClure apparently hoped that he had won agreement by the president not to veto the public works bill and to continue developing the components of a breeder reactor in exchange for no confrontation now on where it will be built.