House-Senate conferees finally agreed last night on a black-lung benefit bill in which strangely enough the key was not coal but oil.

The agreement, still subject to House and Senate approval ended a weeks-long staring match between two of the williest legislators in Congress. Sen. Russell B. Long (D-La.), chairman of the Senate Finance Committee, and Rep. Carl D. Perkins (D-Ky.), chairman of House Education and Labor.

Both House and Senate bills liberalized provisions under which disabled miners can qualify for black-lung benefits and established an industry-financed trust fund to pay the cost. These were not the main issues in the conference.

Instead, the conferees were hung up for weeks over the financial formula for the trust fund. And underlying this hangup was the welfare of the oil industry, which controls at least a fifth of the nation's coal production and has billions of tons of coal reserves in the West.

Long, the foremost congressional champion of oil interests, clung tenaciously to a formula that would have saved tens of millions of dollars for the Western producers among whom the oil companies are heavily represented.

His formula, drawn up by the Finance Committee, would have taxed coal on the basis of its heat content, measured in BTUs or British thermal units.

Since much of the Western coal is of low heat quality the burden of underwriting the liberalized black-lung benefits would fall most heavily on better quality Eastern coal.

The House, by contrast, had approved a formula taxing coal by the ton regardless of heat content, which would have put East and West on a more equal footing.

Perkins thought he had allies for the House version of the bill among Senate conferees from Eastern states, including Sens. Jennings Randolph (D.W. Va.) and Richard S. Schweiker (R-Pa.). But yesterday Randolph and Schweiker turned out to be more senators than Easterners.

Both men stuck with Long, and Perkins had to give ground. Under the compromise, the whole financing section was dropped from the benefits legislation. Long agreed to push through the Senate a separate financing bill that would not tax coal either by the ton or by heat content.

Instead, it would distinguish between deep-mined and strip-mined coal, with the latter being taxed the least. It was not lost on anyone in the conference room that by far the largest part of Western coal comes from strip mines, while in the East there is more underground mining. Thus the West would win under Long's new formula just as it did in the old.

The compromise sets a tax of 50 cents per ton on deep-mined coal and 25 cents per ton on strip-mined coal. At last year's national production total of 675 million tons such a tax would have raised about $240 million - an amount Perkins later said he felt would be adequate to underwriter the trust fund.

Last night's agreement was left subject to Long's ability to move the separate financing package through the Senate as a rider to another revenue bill. Perkins recessed, rather than adjourned, the conference saying he would reconvene if the Senate did not act within 60 days.

"We didn't give too much away," Perkins said. But he conceded that he was "surprised" when faced yesterday with the quickly eroding support of his presumed allies.

Under the approach to which Long had held for months, some to the principal beneficiaries of the plan would have been Exxon, which has some 11 billion tons in reserve. Standard Oil of California, Sun Oil, Atlantic Richfield, and Kerr-McGee all heavyweights in the Western coal reserves.

To a lesser degree, the Long proposal would have helped Amax, partially owned by Standard of California, and the coal division of Ashland Oil, both of which have large reserves in Wyoming. In each instance the oil company's coal mining sisters expect to mine the largest amount of their reserves by stripping.

In the East, where underground mining is more prevalent, several oil controlled mining firms would not have benefited from the Long approach. They include Consolidation Coal, owned by Continental Oil; Island Creek Coal, owned by Occidental Petroleum and Old Ben Coal, controlled by Standard Oil of Ohio.