The House Ways and Means Committee yesterday approved a crackdown on tax preferences for oil and gas producers, the most politically charged and symbolically important industry in the struggle to overhaul the tax code.

The package, approved 29 to 4, goes further in cutting oil and gas tax benefits than President Reagan had wanted, but does not reduce them as much as Committee Chairman Dan Rostenkowski (D-Ill.) has proposed.

The chairman's original energy plan would have raised $9.1 billion over five years, compared with $1.9 billion in the Reagan proposal. The compromise would raise $4.2 billion from the oil and gas industry, and $4.3 billion from a new non-oil tax provision.

The committee recessed last night without considering the next item on its agenda, a strengthened minimum tax on individuals and corporations. Committee aides said Rostenkowski still hopes to complete consideration of the tax overhaul package on Friday.

Treasury Secretary James A. Baker III played an uncharacteristically visible role in negotiations over the energy provisions, congressional sources said.

He met with Rostenkowski Monday to ask him to support the Reagan proposals on oil and gas, and has visited separately with Ways and Means Committee members from oil-producing states, including his home state of Texas.

On Monday evening, Baker and Deputy Treasury Secretary Richard G. Darman appeared at a meeting in the Capitol with oil lobbyists and oil-state Ways and Means members. Baker reiterated the administration's support for its own oil provisions, but encouraged industry officials to seek an acceptable compromise, sources said.

Asked if Reagan would oppose the bill if oil tax benefits were cut back too much, Baker avoided a direct response, saying that the administration hoped to deal with the issue in the Senate.

Rostenkowski was said to be "incredulous" that Baker not only was working against him, but also was meeting with industry lobbyists. Although Baker has been present at other committee sessions and expressed the administration view on other issues, this is by far the most intense effort he has made, sources said.

In the area of business depreciation write-offs for investment, for example, the committee made changes at least as major as the compromise on oil.

Business lobbyists consider the Ways and Means depreciation scheme, approved by the committee Tuesday, as a major setback. Yet the administration did not object to the changes or defend the Reagan plan in committee.

Meanwhile, the 140-member House Republican Study Committee yesterday approved a resolution condemning the Ways and Means legislation and urging the GOP leadership to propose its own bill on the floor. The roughly 35 members present at the meeting were said to have approved the resolution unanimously.

Specifically, the oil compromise would let producers deduct in the first year certain "intangible" drilling costs, but fewer of those costs would be allowed than are now permitted.

All costs incurred during and after the time the pipe is sunk into the ground would have to be written off over 26 months, a change from current law.

The oil and gas compromise raises most of its revenue by adding a provision not specifically related to that industry. It would remove some of the tax advantages of a corporate liquidation, merger or takeover.

Now, companies can transfer their securities in those situations and the recipients do not have to pay capital-gains taxes on the amount the securities have increased in value. The change would end that practice.

Other oil provisions essentially split the difference between what Reagan and Rostenkowski wanted, although one, a benefit called the depletion allowance, would be scaled back less than in either package.