Two weeks after President Reagan unveiled his sweeping tax- revision proposal, one of its cornerstones is threatening to crumble.

Tax writers in both houses have expressed grave doubts about a proposed tax that administration officials call vital to the fiscal soundness of the president's plan.

By 1989, the "recapture" provision would impose $57 billion in new taxes on companies that claimed large write-offs for investments over the past four years. The provision aims to prevent "windfall gains" by companies that deferred billions of dollars in taxes under the existing 46 percent tax rate and would end up with a 33 percent rate under the overhaul plan.

However, it hits certain companies harder than others -- specifically, those that invested heavily in equipment and machinery since the 1981 tax act. General Motors Corp., which generally backs Reagan's plan, would pay more than 2 percent of the total. AT&T and IBM would not be far behind.

Some congressional tax writers and many business leaders said last week the provision would amount to an unfair penalty on one sector. They also said it would play havoc with business plans conceived under current law.

"We made a commitment to the investor," said House Ways and Means Committee Chairman Dan Rostenkowski (D-Ill.). "I don't like writing tax law that way."

"Both from an academic and a practical standpoint, we all oppose it," Procter & Gamble Co. President John G. Smale told the Senate Finance Committee. He was one of a panel of corporate executives who generally favored overhauling the tax code.

Sources said Treasury Secretary James A. Baker III recognized the inequities of targeting the recapture tax on beneficiaries of depreciation write-offs, rather than spreading the burden to those who take advantage of other tax preferences.

But the quandary is similar to that surrounding another controversial proposal, to repeal the deduction for state and local taxes. Without the recapture provision, Reagan's tax-simplification plan would sharply increase the deficit.

Lawmakers asked witnesses last week to suggest how to make up the difference.

"The recapture provision crept in rather late in the process because they administration officials were short of money," said Senate Finance Committee Chairman Bob Packwood (R-Ore.). "What many of us are afraid of is that when we get to the end of the bill, we may be a couple of hundred billions dollars short, and where do we get the money?"

Sources said several legislators and lobbyists were weighing a plan to extend the recapture tax to beneficiaries of other write-offs, such as oil companies that wrote off intangible drilling costs, defense contractors who deferred taxes under the completed-contract accounting method and more.

The controversy is significant because the recapture tax, and the depreciation proposals in general, represent the greatest difference between the Treasury Department's original proposal last November and Reagan's plan.

Treasury originally proposed stiff limits on depreciation write-offs, which would have increased taxes by $200 billion by 1990.

Reagan's depreciation proposal is expected to yield only $40 billion in extra taxes. Despite the recapture proposal, which adds $57 billion, Reagan's plan is still significantly less tough on industry than Treasury's. Companies consider the recapture tax to be harsh because it would be collected over a period of only four years.

Besides the recapture provision, several other "gimmicks," as witnesses at the hearings called them, are drawing opposition.

For example, under Reagan's plan, companies that contracted to purchase equipment under the current law's generous rules -- but didn't consummate the purchase until after the law was changed -- would in many cases be governed by the stricter depreciation rules. Rostenkowski has said he thinks this would paralyze investment while Congress debates the bill.

But eliminating that provision would cost about $8 billion, according to the Treasury.

Congress is considered likely to alter the effective dates of some of the provisions, also at considerable cost. Reagan's plan would terminate many deductions and credits as soon as it is enacted, but it would delay tax cuts for six months.

Similarly, his proposal to allow companies to index the value of business inventories, thereby reducing tax bills, would not take effect until a year after enactment. Other tax-reducing provisions would be delayed longer.

"These changes have little to do with tax reform; they are selective tax increases that do not seem especially fair or economically justifiable," University of Pennsylvania economics professor Alan J. Auerbach told the House Ways and Means Committee. "But they are dwarfed in magnitude by the proposed windfall tax on excess depreciation."

The recapture tax is considered the tax package's most controversial and innovative feature on the business side. Economists have long pointed out that lowering tax rates results in windfall gains for those who have used deductions to defer taxes in a period of higher rates.

Under the system of accelerated depreciation created by Reagan's 1981 tax act, companies write off the full value of equipment, machinery and structures in much less time than it takes them to wear out, thus "sheltering" income in the early years. They pay the difference once the equipment has been fully depreciated. If rates are lowered before this happens, companies will repay less than they would have.

Business leaders, who are bitterly divided over the president's proposal, have coalesced around the argument that the recapture tax is unfair.

No matter how much they dislike the provision, however, congressional tax writers may be stuck with it if they can't come up with another way to raise a lot of revenue.

Business executives and economists queried at the hearings tended to suggest ways that were politically impossible, such as increasing the taxation of employe fringe benefits. Or they proposed ways that would not bring in enough money, such as curbing tax breaks for the oil and gas industry.

"As night follows day, Congress will clearly have to consider expanding the recapture tax ," said Jack Albertine of the American Business Conference, a leading supporter of tax overhaul. "They're looking for ways to enhance the revenue gain from the tax plan, and it's inevitable that they're going to go in that direction.