Samuel R. Pierce Jr., secretary-designate for housing and urban development, promised yesterday to cut federal housing costs but no reduce aid to the poor.

His shillful performance at confirmation hearings before the Senate Banking Committee sounded good to both conservatives and liberals. They appeared ready to give unanimous approval to the New York City lawyer who will be the only black member of the Reagan Cabinet. Only nine committee members showed up for the hearing and most remained only long enough to express their esteem and then departed for more controversial hearings on other nominees.

Sen. Christopher Dodd (D-Conn.) expressed concern at a proposal by incoming budget direct David A. Stockman that community development grants be cut by one-third, which would mean a loss of $84 million to New York City. Pierce called the figures "startling" but said the administration's first task is to get the economy back on track and that the need to stop inflation will require cuts across the board.

"I agree with those who say we have to improve the economy before we get the results we want in housing" and other areas, Pierce said. But he went on to say that he will be "an advocate of my department," that he believes better housing programs can be achieved at less cost and that "we will not turn our backs on the needy. We will be sure they will be taken care of no matter what happens."

Asked by Sen. William Proxmire (D-Wis.) if HUD might have to take a 10 percent cut, Pierce said that was possible although he had made no study to arrive at a figure. He insisted there would be no reduction in HUD activities and said that if he were ordered to take a greater cut than he believed in, he would resign.

Pierce, 58, whose career has included experience as general counsel to the Treasury Department and as an antitrust counsel on the House Judiciary Committee staff, said some money could be saved by scrapping many of the HUD regulations that slow local housing construction. Banking Committee Chairman Jake Garn (R-Utah), former mayor of Salt Lake City, warmly endorsed that proposal, recalling his own losing efforts to cut federal red tape in city hall.

Pierce also proposed tilting the big Section 8 rental subsidy program more toward rehabilitating existing housing rather than building more expensive new homes, perhaps cutting back on community development block grants, urban development action grants and a new solar energy program.

He opposed suggestions that the problems of depressed older northern cities be handled by encouraging migration to the booming Sun Belt. "I wouldn't turn my back on distressed cities," said Pierce. We must make the country as a whole work."

Pierce also said he would oppose withholding housing assistance to areas under rent control. He believes that controls hold down housing construction by limiting return on investment, but said the federal government should not tell local governments what they can or cannot do.

Pierce said he favors strengthening the 1968 law outlawing racial discrimination in housing but has not decided on the best mechanism to enforce it. Congress could not agree last year whether the mechanism should be administrative orders or judicial decisions, and finally let the bill die.