About 70 janitors and housekeepers, some of whom worked for more than 10 years at the Department of Housing and Urban Development headquarters, lost their jobs this week when HUD hired a new contractor who is hiring welfare recipients and others to replace the unionized cleaning staff.

The workers are among the latest casualties of an intensifying effort by government agencies to cut costs. HUD "privatized" its janitorial services in the 1970s by hiring contractors to perform work previously done by government workers, and HUD is now cutting costs further by awarding the $1.5 million job contract to a firm that underbid the former contractor.

"We now have the screwy situation where they are taking people off welfare, and replacing people who were working, and putting them on welfare by taking their jobs," said Jay Hessey, an organizer for the Service Employees International Union, which represents about 800 janitors in 30 federal buildings here.

Unionized janitors lost jobs in similar circumstances at the Departments of State and Agriculture in the past year, according to the union.

"It's really bad when you have worked in one place for a long time and then you are out of luck," said Helen Wilson, 51, who has worked at HUD headquarters in Southwest since 1980. Wilson, who received a termination notice Friday, said she applied for a job with the new contractor, Safeguard Maintenance Inc. of Timonium, Md., but was told Monday that her position was already filled.

"You may not think it is fair, but this is how the system works," said Bernard Shapiro, a lawyer for Safeguard, who said the firm is under no legal obligation to hire workers formerly employed by the previous contractor, Eastern Services Inc. of Philadelphia.

"Any contractor has the right to use his own employes," he said, adding that former employes could submit job applications. The union said it knew of only one former employe who has been hired.

HUD expects to save $150,000 a year by switching to Safeguard, according to Michael Rubino, director of facilities operations. The janitorial contract was previously reserved for minority-owned contractors, but the agency, seeking to cut costs, solicited new bids from all interested firms and got 25 proposals.

An HUD official, who asked not to be identified, said, "This whole thing stinks to high heaven. They went to the cheapest, lowest dollar, and did this with absolutely no feeling for the people involved. It is just cold and inhuman, but it's a case of going to the cheapest dollar."

Rubino said such comments "are a little harsh. We want to get the best price for the government, and we have no influence over the contractor's policy" on hiring.

The former janitors and housekeepers earned an average hourly wage of $7.40, and the new contractor will be required to pay the same wage under the Service Contracts Act. That 1965 law covers nearly 1 million service workers employed by government contractors, who must pay "prevailing" wages and benefits in each locality.

Union organizer Hessey said a prime reason that the new contractor wants to hire new employes is that the veterans accumulated up to three weeks of paid vacation under the union contract, to which new hires will not be entitled. Also, the new firm will be able to pay lower levels of some fringe benefits, he said.

Frederick Burks, chief executive of Eastern Services, said that his former employes "were good workers, and they should be offered jobs."

Safeguard contacted District welfare officials and received 26 applications through the Work Incentive Program and have hired at least nine welfare recipients, a program spokesman said.

Wilson said she believed that she "really needed a union in this kind of job, with all the hiring and firing. You have no protection in this kind of job without a union." She said Safeguard officials told workers Monday that they wanted a nonunion work force. Safeguard officials were not available for comment, but Shapiro said the firm employs union members at other locations.