The nation's home building industry is emerging from the worst recession since World War II in much the same manner as its product--smaller, leaner, and much more cost-conscious.

The industry has long been known as a field of independent-minded entrepreneurs making big money during good times and hanging on through the slumps. But the recent downturn was so long and so severe that many of the nation's builders didn't survive it, and those that did are a chastened lot, looking to hedge their bets wherever possible.

The industry "isn't returning to business as usual," said Jay Shackford of the National Association of Home Builders, which lost 20,000 of its 125,000 members. "It's a different economy. The financing is different, the product is different."

To deal with these changes, builders are diversifying as never before, getting into products and businesses designed both to facilitate home sales and to provide income when the home market goes sour. In general, this diversification falls into three categories:

* New products. Many builders are shifting down--from detached houses to townhouses, townhouses to condominiums and rental apartments--while others are shifting to light commercial construction, such as shopping centers and small suburban office buildings.

* Financing. Growing numbers of builders are forming or acquiring mortgage banking or other specialized financial subsidiaries. Such acquisitions not only enable the builder to find a ready lender for his customers, but also, through loan service and other fees, provide a steady income when houses aren't selling.

* Related services. From building apartments, it is a simple matter to move into managing them, and builders are doing just that. In addition, some are setting up insurance arms, investment subsidiaries and real estate sales companies.

Diversification is not entirely new, and in the past as now, it has generally been the product of bad times.

Harvey A. Edwards, head of a now thoroughly diversified building concern in Tuscaloosa, Ala., remembers that in the 1950s, "We got caught with a whole subdivision. It was sold but not closed" when a money crunch hit and buyers couldn't get loans."

Edwards survived, but it taught him a lesson--what had happened once could happen again. Now his operation consists of 17 firms, including a construction company, an insurance company, a management company and an investment company.

"We saw it coming," he says of the recent recession, and because of diversification, "we've been busy when other folks haven't."

Another early learner was Harry Pryde, currently president of NAHB. When Seattle took it on the chin in the Boeing slump of the early '70s, Pryde went through much the same process, moving into finance and rental management.

But across most of the country, few builders had gone through the kind of trial by fire that the last two years have provided.

The recession for housing was the longest and deepest since World War II. Beginning with the Federal Reserve's decision in the fall of 1979 to tighten up on the money supply, interest rates climbed to rates unknown in the 20th century. At the height of the spiral, mortgage loans of 18 percent a year and more were being written.

Housing, a market which depends as few others on borrowed money, went into a tailspin.

Housing starts, running at an annualized rate of 1.9 million in May of 1979, sank to less than a million one year later; sales of existing homes, running at better than 4 million in May 1979, stood at 2.48 million in May 1980 and at 1.9 million two years after that.

The consequences rippled outward into related industries such as building materials, furniture, appliances and carpeting. Between May 1979 and May 1982, 49,000 production jobs disappeared in the household furniture industry, according to the Bureau ofLabor Statistics. Unemployment in sawmills hit 20.1 percent and in softwood veneer and plywood mills, 31.5 percent.

Hardest hit among the homebuilders were the medium-sized companies, or those doing between 25 and 100 units a year. Too small to endure month after month of losses and too large simply to close up shop and hibernate, many of these firms, and even some larger ones, were destroyed.

Those who were smart--or lucky--found something else to do.

"We got into light commercial" work, said David Smith of David Smith Builders, a firm active in homebuilding in the Virginia and Maryland suburbs.

"We built a shopping center . . . and then did the tenant work in the shopping center," Smith said. The firm won a contract to convert a former cannery into a research facility and then did a small office building.

"It's almost a necessity for builders to diversify to get away from the peaks and valleys of single-family homes," Smith said, adding that commercial projects work out very well for the firm even now that housing is coming back.

The light commercial projects are "mostly subcontract work," meaning that Smith's firm, as the general contractor, supervises, but most of the actual work is done by subcontractors. "You don't need as many men," Smith said, so "we can roll off housing very easily" and into commercial.

Indeed, "with a good superintendent and a couple of laborers" the firm can handle a light commercial project, thus enabling itself to do "a little of both housing and commercial at the same time."

"We need to encourage our builders to build some things for themselves as investments," Smith said, so they will have money coming in when housing is slow. He noted that the firm's shopping center provided it with cash flow at times when there otherwise would have been none.

Financial subsidiaries can be another source of cash during bad times.

A survey last fall by Fortune magazine found that in 1981 between a quarter and a half of the profits of some of the nation's biggest builders came from their mortgage arms. In earlier boom years, the contribution had been only 2 to 20 percent.

It found that in the first half of last year, mortgage operations accounted for fully 50.5 percent of U.S. Home's profits; 32.8 percent of Pulte Home's, and 29.3 percent of the Ryland Group's.

The benefit of a mortgage banking subsidiary is twofold.

First, the subsidiary makes loans to home buyers and sells the loans into the secondary mortgage market. This way it raises cash for more loans and continues to service the notes it has sold, thus providing a steady stream of revenue.

Second, the subsidiary provides the expertise and a conduit that the builder can use to tap the capital markets directly, using what is called a builder bond.

In this setup, a builder closes a group of mortgage loans but retains an interest in them. He then packages them into a security, which he places with the subsidiary. The subsidiary then issues bonds with the securities as collateral.

This raises cash for the developer while at the same time giving him an installment sale for tax purposes.

So far this technique has been largely confined to big builders, but according to Betsy Qutb, head of NAHB's mortgage finance department, smaller firms are exploring ways to use established mortgage companies to achieve the same thing.

The net result of all these changes, according to NAHB chief economist Michael Sumichrast, is that the number of large builders is growing and, oddly, so is the number of small ones.

These new "little guys" are not coming up from the construction trades as was once the case, Sumichrast said. Instead, they are coming from business schools, bringing with them knowledge of finance and management rather than hammers and nails.

"Housing has changed so much," Sumichrast said. "Finance is so important now. It's not just sticks and stones anymore."