Members of the House Ways and Means Committee returned from a weekend retreat yesterday saying that they are committed to overhauling the tax code, and Chairman Dan Rostenkowski (D-Ill.) -- surprising some of his troops -- predicted that the panel will take three weeks or less to write a bill.

"With bipartisan effort, patience and flexibility, we'll have a tax bill within two or three weeks" after bill-drafting begins, he said. "I'm pleased with the outcome."

Rostenkowski said he plans to announce a schedule early this week for writing the bill. Committee members said they expect to hold initial sessions during the week of Sept. 23 to work out procedures and a timetable, and to get down to specifics the following week. If Rostenkowski is correct, that would mean the panel would produce a bill by mid- to late October.

But his timetable may have been a little optimistic for some of the committee members also gathered around the microphones after stepping down from a chartered bus. They looked a bit startled. But they agreed that the meeting had produced a commitment to work on producing a tax-revision measure.

"There might be some slippage on that date. I don't see how they can move that fast," said Rep. J.J. (Jake) Pickle (D-Tex.). "But the general significance of it was that there was an agreement we should do what we could to get out a bill."

Treasury Secretary James A. Baker III, who attended the skull session at Airlie House in Warrenton, Va., said the meeting had "moved the process forward" and that there is a "fair shot" of completing work on tax revision this year.

President Reagan's commitment to pushing his tax plan in Congress "is deep. It is total. It is absolute. It is unswerving," Baker said.

Yesterday's schedule included one 45-minute session with all 33 committee members attending, but the rest of the two-day retreat was taken up principally with presentations by academic experts on tax policy and discussions of issues involved in overhauling the tax code.

The seminar was never intended to produce agreement on a compromise tax bill, although Rep. Bill Archer (R-Tex.) told reporters afterward that the meetings had revealed areas of agreement and areas where there will be "tough sledding."

Committee members said the Reagan proposal, which would set three tax rates of 15 percent, 25 percent and 35 percent while wiping out or limiting numerous tax breaks, probably will be used as the main working document. Alternatives to various provisions, prepared by the committee staff, will be proposed on major elements of the plan, a committee aide said.

In their closed meeting members discussed possible compromises on the administration's proposal to end the tax deduction for state and local income, sales and property taxes.

"I get the sense, although nobody has taken a vote, that a lot of people are interested in some compromise on the issue," said Rep. Richard A. Gephardt (D-Mo.). "It's been drawn too starkly. There are about 10 alternatives" to eliminating the deduction.

Baker also implied at the meeting that the administration would negotiate on this issue, telling members Saturday that only three elements of the plan are considered to be set in concrete: a top tax rate for individuals no higher than 35 percent, a decrease in the tax burden on the working poor and the retention of the deduction for interest paid on a home-mortgage loan.

The administration also will insist that any tax measure bring in the same amount of revenue as the current tax code does, Baker said. Speaking to reporters yesterday, he declined to be more specific.

Pickle said there is a tacit agreement among panel members to shoot for a top rate of 35 percent, as Reagan wants, and to try to adhere to his other goals as well.