In a defeat for President Reagan and House Ways and Means Committee Chairman Dan Rostenkowski (D-Ill.), House tax writers yesterday opened two new loopholes in the tax code.

The committee, in the only meeting on tax revision it will hold this week, voted to retain, with limits, a provision scheduled to expire that lets taxpayers who do not itemize their deductions write off contributions to charity. And it agreed to cut taxes for commercial banks rather than raise them, as Reagan and Rostenkowski had wanted.

During their two weeks of tax writing, legislators have made changes in the tax package proposed by Rostenkowski that together would reduce tax revenue by $13.5 billion over the next five years. If Ways and Means continues approving tax cuts, the package could well founder amid fears it would increase the federal deficit.

Rostenkowski has scheduled no further meetings on overhauling the tax code, which he strongly supports. He and other senior members of the panel will spend the rest of the week in a House-Senate conference committee on deficit-reduction legislation, and in drafting legislation that would impose a new tax aimed at helping clean up toxic wastes.

Aides said the chairman is determined to keep trying to overhaul the tax code, and has not ruled out a bill-writing session on Saturday or next week. If the budget conference drags on, he may try to work on it and the tax legislation at the same time. Aides also emphasized that all changes made by the committee are tentative.

But Rostenkowski was clearly disturbed yesterday when committee members outvoted him and accepted an amendment that will cut the taxes of commercial banks by $7.6 billion from what Rostenkowski wanted, or by $4.7 billion relative to the current tax code.

According to sources present during the closed-door session, Rostenkowski threw down his pencil and angrily told his members the amendment was "more generous than current law."

"We won," exclaimed a banking lobbyist as he showed a copy of the 17-to-13 roll-call vote to his colleagues standing in the halls of the Longworth Building.

The Rostenkowski and Reagan tax plans both had called for changing the system by which banks set aside specific amounts of money to cover debts that go bad. They can write these amounts off even if the debts have not yet soured. The Reagan and Rostenkowski proposals would have let banks write off such debts only after they had clearly gone bad.

The amendment, proposed by Rep. Ronnie G. Flippo (D-Ala.), would let banks enlarge their automatic write-offs, making the current system more generous. Another amendment proposed by Rep. Beryl Anthony Jr. (D-Ark.) covering savings and loan institutions was less kind than the current tax code but more generous than Rostenkowski had proposed. It would lose $1.2 billion in tax revenue.

The charitable-contribution amendment, which would limit the write-offs to contributions that exceed $100, would have cost $7.3 billion in revenue because it retained a deduction that otherwise expires at the end of next year. But an amendment proposed by Rep. Judd Gregg (R-N.H.) provided for a smaller-than-expected increase in the standard deduction, used by taxpayers who do not itemize their deductions. That would provide additional revenue to offset the cost of the charitable amendment.

The lowest-income taxpayers would continue to get the full increase in the standard deduction, but the rise would be smaller for married taxpayers earning more than $14,000 per year, single parents earning more than $10,500 per year and single taxpayers earning more than $8,000 per year. All taxpayers who use the standard deduction would still get a larger deduction than they do now.