When Jimmy Carter campaigned for president in 1976, one of his major themes was the need for tax "reform." Time after time, then candidate Carter railed against tax "loopholes" that he said were primarily benefitting the rich and costing the Treasury billions.

Today, three years later, Carter's administration is stalemated over a loophole that is turning a tax break for state and local governments into a mortgage subsidy for higher-income homebuyers - at a potential loss to the Treasury of several billion dollars a year.

Although Carter announced plans in January to seek to close this loophole, the White House has stood by for months while the key cabinet departments involved have gotten embroiled in an inter-agency feud. The administration still has not come up with a bill.

As a result, Congress has had to act on its own to stem the revenue drain-a rare posture for the lawmakers. Rep. Al Ullman (D-Ore.), chairman of the House Ways and Means Commitee, has introduced legislation to close off the loophole. But he hasn't yet gotten White House backing.

The issue involves abuses by cities and counties of the tax exemption for interest on state and local government bonds-specifically to finance single-family housing. Until 1978, the break was used mainly by states to help build low-income homes. The exemption underwrote low-interest mortgages.

But last year, several major cities and counties began using the tax subsidy to help channel theses loans to middle- and upper-income buyers-often with incomes of $40,000 or more. The break enables them to get 8 percent or lower mortgages where the conventional rate is 10 percent or higher.

Not only did these new ventures abuse the basic exemption for cities and counties, but the trend spread like wildfire as conventional loan rates edged up even higher. So far this year, localities have written some $1.3 billion worth of these bonds, with $2.5 billion pending.

The equity issue alone would be one of concern to any would-be tax "reformer." Congress enacted the tax-exemption for state and local bonds to enable states and localities to help finance private construction that would benefit the whole community-airports, for example.

But the revenue implications are even more staggering: At a rate of $1 billion in new issues a month, the explosion in bonds for single-family homes easily could reach $12 billion this year, and $36 billion by 1981. Although estimates are inexact, the revenue drain would be billions.

By comparison, the foreign tax credit allowed the oil companies and other corporations amounts only to $1.7 billion a year, while writeoffs for spending on new energy exploration and development cost the Treasury only $1 billion. Both are far below the cost of these bonds.

For all their ready carping about the federal government's wastrel ways, the cities and counties won't crack down on these abuses. Subsidizing middle- and upper-income homebuyers is a popular move amid the taxpayers' rebellion. And the cost is picked up by Uncle Sam.

So, it's up to Carter, who recognized the problem back in January, but still has not moved to resolve the split within the administration. The Treasury, concerned about the large revenue loss, has been urging a swift crackdown, but other agencies have demurred.

The Department of Housing and Urban Development, anxious in the face of cutbacks in its regular housing programs, wants to keep this avenue open even with the obvious abuse. And the Office of Management and Budget has come out somewhere in-between.

Ullman's own bill, co-sponsored by Rep. Barber B. Conable (R.N.Y.), ranking Republican on the Ways and Means Committee, would put a stop to the current abuses by prohibiting use of the exemption to finance owner-occupied homes and all but low income rental housing.

But the Ullman-Conable proposal, while likely to get through the Ways and Means Committee, could be watered down further in the House, and probably will run into trouble in the Senate. As a measure of the pressures involved, 140 witnesses already have asked to testify.

There's no question the abuses have turned into big business. On the day word leaked out about Ullman's plan to close the housing bond loophole, investment houses rushed through more than a dozen large new issues to beat the deadline. More are waiting if his bill ever falters.

What congressional sponsors are hoping for is a clear signal of support from Carter, who, if he wants, can help muster public backing for the move. In a time of concern about the federal deficit, Hill figures say the revenue implications alone ought to provide a strong argument.

Meanwhile, with housing costs increasing, the potential drain on the Treasury is growing larger every month. And Carter's January promise to close the housing bond loophole-which seemed to take the lead at the time he proposed it-still is unfulfilled.