The Department of Housing and Urban Development announced yesterday that it will target $174 million in housing assistance money for 23 "hard pressed" cities, including Washington and Baltimore, that have been competing unsuccessfully with their suburbs for the money.

Under a new distribution formula, federal rental assistance funds for low- and moderate-income families allocated under HUB's Section 8 program and public housing funds for the poor will flow separately and directly to central cities.

Under the old formula, funds was allocated to metropolitan areas - of which the cities are only a part - and then often carved up to the advantage of outlying suburban areas.

During last year's election campaign, candidate Jimmy Carter promised that he would aid the nation's ailing cities if he were elected. Since his election with the help of central city voters, President Carter has been under constant pressure from big city mayors to make good on his promises.

While yesterday's announcement from HUD does not increase the overall amount of money to be allocated under Section 8 or the public housing program, the new formula should, HUD officials said, mean that the 23 central cities will receive a larger proportion of the money available.

Under the new formula, for example, the District of Columbia is scheduled to receive $4.69 million in housing assistance money next year while Baltimore will get $4.14 million.How much these cities would have received under the old formula could not be determined because the amount would have depended on how well they competed with other jurisdictions in their metropolitan areas, HUD officials said.

HUD officials said yesterday that central cities frequently were at a disadvantage under the old system because developers found it more attractive to build Section 8 projects for elderly suburban residents than to put up developments for low-income families in cities.

Also, because the central cities had to complete with surrounding jurisdications for funds under the old system, they seldom knew how much federal housing money they could expect, HUD officials said.

"The cities fould it hard to plan because of that," said one official. "They never knew what to expect, and as a result they really couldn't attract developers. Now, they'll probably get more money because they could attract more developers . . . At least, they have more predictability (on the amount of money they will receive)," the HUD official said.

Under the Section 8 program (which is much larger than HUD's public housing effort), the government assures developers who win approval for their projects that HUD will subsidize for up to 40 years the rents of qualified families or elderly persons who live in the apartments.

But private developers or state housing agencies must want to build the developments before HUD can approve them. Proposals have come in more quicky for suburban projects thus far - to the detriment of cities that have need of subsidized housing for their low- and moderate-income citizens.

HUD Secretary Patricia Roberts Harris said that, despite the new distribution formula, suburban agras will continue to receive their "fair share" of the assisted housing financed by Section 8 and the public housing program.

However, other HUD officials conceded that the suburban "fair share" probably will decrease as a result of the new distribution formula, with its guarantee that cities will receive more housing assistance money than they are now receiving.

Harris said the new formula "should encourage builder interest in meeting the housing needs of the central city rather than the more diffuse needs of entire" metropolitan areas.

HUD subordinates said that the change announced yesterday is in keeping with Harris' stated position of targeting more federal aid to the "older and distressed cities."

"We have a lot of money out there now that is theoretically available to deal with the problems of the distressed cities," Harris was recently quoted in U.S. News and World Report. "Our approach will be to target federal funds from existing programs, rather than to create large numbers of new programs," she said.

Cities other than Washington and Baltimore scheduled to receive direct funding under the new formula include: New York, $66.45 million; Chicago, $19.31 million; Los Angeles, $13.19 million; Philadelphia, $8.58 million; Houston, $2.08 million; Detroit, $6.56 million; Dallas, $1.29 million; San Antonio, $3.26 million; Indianapolis, $2.39 million; Honolulu, $4.444 million; and Milwaukee, $3.48 million.

Also, San Francisco, $5.63 million; Boston, $6.34 million; Jacksonville, Fla., $1.76 million; Memphis, $3.5 million; Cleveland, $3.81 million; Columbus, Ohio, $2.16 million; St. Louis, $3.15 million; San Jose, Calif., $2.15 million; Seattle, $2.97 million, and New Orleans, $3.14 million.