If President Reagan carries out threats to veto a $5 billion housing stimulus bill, he will find himself squared off against a Congress that is unusually united behind the plan in its growing impatience over the recession.

There is a good chance Congress could hand Reagan his first veto override on the interest-rate subsidy program--approved overwhelmingly by both houses with support from a majority of Republicans as well as Democrats--administration and Capitol Hill analysts say. The bill still must go through a joint conference committee to resolve some differences in approach, but it is expected to be before the president soon after Congress returns from its Memorial Day recess.

Reagan then is almost certain to veto it, according to administration and Hill sources, in an attempt to show resolve over the budget deficit and rejection of special assistance for any one hard-hit sector of the economy.

"He's itching to veto a bail-out bill, and this is a likely target," said one administration source. "The place to send the signal is on the first one."

Reagan has not flatly committed himself to a veto, however. Hill analysts point out that if he decided the arithmetic in Congress dictated that he back off and sign the measure, he could cite as a reason the "emergency" nature of other parts of the supplemental appropriations bill to which the program is attached.

The Republican sponsors of the housing legislation, meanwhile, protest that their plan is not just the first of many special assistance bills, but the one program that Congress will rely on to create jobs and lead the way to recovery. They vow that other major distressed industries--autos and airlines, steel and farming--will not get their turn at the trough this election year.

Under the housing plan, the federal government would pay 4 percentage points of the interest rate on mortgages on newly built homes for five years. That would bring current rates down to 11 1/2 percent for about 400,000 moderate-income families, creating a more favorable market for the stagnant housing industry. Proponents claim this would put about 700,000 unemployed persons back to work this year, enough to shave not quite one-tenth of a percentage point off the current 9.5 percent jobless rate. The interest-rate subsidy, which could be worth more than $13,000 on a new home over the five years, eventually would have to be repaid by the homebuyer.

Sen. Richard Lugar (R-Ind.), the author of the program, insists that he is not involved in a confrontation with the administration and says he still hopes to persuade the president to sign the bill when it gets to him.

This has put Lugar in the odd position of portraying the $5 billion Senate bill as a good, Republican cloth coat to thaw the frozen economy--and the $4.5 billion House program as a Democratic mink, a full-length extravagance that does far more than cover the bare necessities for the housing industry.

To hear Lugar talk about it now, he and his president have a common enemy--the House-sponsored "bail-out."

"I hope we can have a good conference with the House . . . and produce a jobs stimulus bill, rather than a bail-out of existing inventory," Lugar said after the Senate approved the plan last week. His plan, he argues, will buy time for Reagan's overall economic program to work and, through jobs creation, will supply-side its way into paying for itself. Sponsors in both houses have promoted this as a jobs bill, but the House plan would allow the subsidy for existing inventory--homes that have already been built but which builders have been unable to sell.

If the president does veto the bill, the outcome of an override attempt could be very close, say Hill analysts on both sides of the issue. Reagan has vetoed three bills so far, including one by pocket veto (in which the president indirectly kills a bill presented to him by Congress within 10 days of its adjournment by failing to sign it before Congress adjourns), and has not been overridden on any.

The Democratically controlled House, which voted 349-55 for the housing bill, would be expected to override a veto easily. But the Republican Senate, despite its lopsided 69-to-22 vote for the measure, could be another matter.

One who says he believes an override by the Senate would be difficult to achieve is Lugar.

"If the president vetoes the bill, many Republicans who were willing to give me the benefit of the doubt on some very tough votes . . . would give the president the benefit of the doubt" on a veto, Lugar said.

Republican loyalty is credited for sustaining the two Reagan vetoes the Senate has voted on so far. But the politics were far different on those issues--last year's continuing budget resolution and an emergency oil allocation bill--because Congress itself was deeply divided on them.

By contrast, the housing bill sped through both houses with surprising and virtually unimpeded velocity, with Republicans and Democrats agreeing that it was important enough to keep free of other pressing and appealing amendments.

Senators were under intense pressure from the White House to oppose the measure, but this had little effect. Lugar said one colleague told him of receiving calls one day from five administration officials, entreating him to vote against the bill.

Members of the housing industry no longer call what's happening to them a recession but an all-out depression that is in its fourth year. And they do not see signs of a recovery any time soon.

New-home starts were edging up at the beginning of the year, and Reagan then cited these figures as evidence of an impending economic recovery. Housing economists said flatly that was not so. Starts have been at such a low level for so long--less than half the rate in 1978--that minor monthly increases are meaningless, the economists said. In April the figures turned down again and for the ninth straight month were at less than an annual rate of one million units.

Resales of homes are just as bad. In April resales for the seventh straight month were below an annual rate of 2 million units, half the rate 3 1/2 years ago.

The administration wants to rely on cutting the budget to bring interest rates down and spur home sales. But senator after senator and representative after representative gave speeches saying the country "cannot afford to wait any longer" for rates to fall.

How much of an impact the mortgage-rate subsidy actually would have on home construction and jobs is subject to debate. Federal Reserve Board Chairman Paul A. Volcker has said that as long as the Fed does not loosen credit--which it does not intend to do--"jobs generated by the new program are likely to come at the expense of jobs lost in other, nonsubsidized parts of the economy."

Mark Riedy, executive vice president of the Mortgage Bankers Association, which has endorsed the mortgage-subsidy plan, guesses that about half of the 400,000 units to be subsidized would be new homes that would not otherwise be built. He and others also point out that many builders already have gone out of business because of the downturn and that it would be difficult for many to gear up to start building again.

But under the Senate version of the bill, only homes that are started this summer and substantially completed by the end of the year would be eligible, and this could force a jolt in building activity and--perhaps as important--a more positive psychology for both builders and potential home buyers, housing economists said.

The program also has become visible and politically potent. It is designed as a boost essentially for the middle class, who no longer view homeownership as the American dream but as an American birthright. It is through such now-traditional federal programs as FHA insurance and the mortgage interest tax deduction that the percentage of Americans owning their own homes rose from one-third to two-thirds in the postwar years.

If Reagan does veto Congress' mortgage-subsidy plan, Democrats up for election in November are ready to use it as an example of how the administration doesn't care about the average American.

"It's a good issue, and Democrats certainly will use it," said one congressional Democratic source. "There already is a lot of talk about the ship going down and the captain won't even throw a life preserver."

But the crew in Congress may mutiny against Reaganomics this time, particularly if they think they are sinking, too. One main reason is that the housing bill is the one program on the horizon that congressional Republicans and Democrats can cling to, to show they are taking some definitive action on the economy. The efforts to hold down government spending have resulted in a historically high budget deficit--hardly a shining badge of accomplishment to display to constituents.

The dilemma for some may be seen in the example of Sen. William Proxmire (D-Wis.), who prides himself on being curmudgeonly about spending. In committee, he went through an impressive list of reasons why the mortgage-subsidy idea is not so great, from his doubts about the jobs impact to its effect on credit for other activities--then he announced his support for it. "I just do not see any alternative if we are going to do anything for the housing industry," he said recently on the Senate floor. "We cannot just hunker down and accept an absolute disaster."

In the end, the 22 senators who voted against the housing subsidy will be the base from which Reagan would have to work to find the necessary two-thirds to sustain a veto. His staunchest ally in the Senate battle was Sen. William Armstrong (R-Colo.), who tried to filibuster the bill with a series of delaying tactics. He found the chore, at times, was a lonely one.

At one point, Armstrong called for a division vote on an amendment, even though there were only seven senators in the chamber at the time, and found he was the only one standing in opposition. Unfazed, he thanked the members who voted with him and added that "having started at somewhat of a low ebb, I will perhaps pick up some steam" later in the debate.

A bemused Sen. Harrison Schmitt (R-N.M.) thereupon rose to put the matter into perspective for the Senate. "Mr. President," he said. "If the senator loses any more ground, he would not even be here."