The Consumer Product Safety Commission, citing possible cancer hazards, ordered a ban yesterday on all future sales of home insulation made with formaldehyde.

As many as half a million homes have been insulated with formaldehyde foam since the mid-1970s as part of a massive government campaign to convince homeowners to conserve energy.

Last year, formaldehyde foam sales totaled about $10 million.

Yesterday's ruling does not cover homes already insulated with formaldehyde foam. Commission officials advise consumers to leave the insulation alone if they have not experienced any health problems.

If problems have occurred, then consumers must solve them on their own, perhaps by taking such drastic steps as ripping out the insulation. Commission and industry officials estimate it could cost $15,000 to remove formaldehyde insulation from homes--more than 10 times the original installation cost.

The commission, in a 4-to-1 vote, concluded that a ban was the only effective way to protect consumers from the formaldehyde gas that is frequently released after the insulation is installed.

Formaldehyde has been shown to cause cancer in animals, and in humans it is known to cause such adverse health effects as nausea, headaches, dizziness, respiratory ailments, bloody noses and eye and skin irritations.

It was chiefly the fear that formaldehyde might cause cancer in humans that led the commission to call the insulation an "unreasonable health risk."

The commission rejected industry pleas for a less onerous regulatory scheme--either labeling or a mandatory installation standard. The ban is to take effect within five months, although the commission could change that timetable.

The ban drew immediate praise from consumer groups, which called it their first major victory from the Reagan administration.

Industry groups, however, denounced the commission's action. The Formaldehyde Institute, which represents manufacturers, called the ban an "abuse of regulatory power," unjustified by medical and scientific findings.

The manufacturers and installers vowed to appeal the ban in the courts as well as Congress, which under recently enacted legislation has the power to veto a commission regulation.

The move to ban urea-formaldehyde foam insulation, or UF-foam as it is commonly called, was led by commission Chairman Nancy Harvey Steorts, a Reagan appointee who has frequently voiced strong opposition to mandatory standards and bans, preferring voluntary industry programs instead.

But, Steorts said, "I have concluded there is not a voluntary solution to this problem . . . . No standard--voluntary or mandatory--can assure the consumer of an installation of urea-formaldehyde foam insulation that will adequately reduce the risk of formaldehyde off-gassing."

Steorts was supported by commissioners R. David Pittle, Edith Barksdale Sloan and Sam Zagoria.

A year ago, when the commission had first proposed a ban, Zagoria had voted against it, favoring a warning label on sales contracts to alert consumers about the product's possible adverse health affects. "I now believe a warning is inadequate to protect consumers against unreasonable risk," he said. "This is a possible killer."

The only dissenter was Commissioner Stuart M. Statler, who argued that a mandatory installation standard, coupled with a labeling and consumer redress program in which installers would correct any problems, would be sufficient to control possible formaldehyde problems.

Nonetheless, Statler added, "I still would not put the product in my own home."

Unlike other types of insulation that are made at factories and then installed in houses, UF-foam is prepared at the site where it is to be installed.

Resembling shaving cream when it is pumped into spaces between walls, UF-foam hardens, forming a layer of insulation. Such insulation has been especially popular among owners of older homes because it could be installed easily--through several holes in walls--without tearing down the walls.

Since the foam insulation became popular in the mid '70s, the commission has received 2,200 complaints, involving some 5,700 people, about adverse health effects.

After concerns about UF-foam became public, the industry experienced a sharp decline, from 170,000 installations at its peak in 1977 to 8,320 installations last year. The 16 manufacturers of the insulation have declined to three; the number of installers decreased from 1,500 to 200.