A senior aide to Mayor Marion Barry said yesterday the city expects the federal government to pay the entire cost of building a new prison in Southeast Washington, estimated at $50 million.

Congress appropriated $30 million for the 700- to 800-bed prison last year. The question of where the additional $20 million would come from has been up in the air since Barry announced his plan for the prison last week, with City Administrator Thomas Downs holding open the possibility that some of the city's own funds might be used.

At a City Council hearing yesterday, Dwight Cropp, the mayor's director of intergovernmental relations, said Barry's position is that the federal government must foot the entire bill, without using money that the federal government pays the city in lieu of property taxes and in return for various services -- known as the "federal payment."

Cropp also said the city would not begin construction until the money was in hand, though he said later the $30 million appropriation by Congress was a sufficient commitment.

The prison, which will focus on treatment of offenders with long histories of alcohol and drug abuse, is the centerpiece of Barry's plan to ease severe overcrowding at the city's jail, halfway houses and the Lorton Reformatory.

In a daily search for space, city officials have resorted to releasing some prisoners early, putting up others on cots in hallways and dayrooms at Lorton, and holding others on buses for as long as 10 hours at a time.

A D.C. Superior Court judge barred the Department of Corrections yesterday from transferring any prison inmates to community-based work programs without court permission, after the judge found the department illegally moved a D.C. Jail inmate with three previous convictions to a halfway house.

Judge Henry F. Greene said the department's action was not a "willful" violation deserving of a contempt citation, but he warned that the department "has been placed on notice about this problem."

Of the estimated $50 million cost of the prison, city officials have only $1 million clearly in hand, though Cropp said "we feel confident" of obtaining the full amount.

City officials have spent $9 million of the $10 million the city received from Congress for the prison last year to add 400 emergency beds at Lorton, and plans to ask the City Council for approval to pay back that money from the city's capital budget. Council Chairman David A. Clarke said yesterday that "the issue will be the mayor coming to us after he spent the money" and belatedly asking for approval.

An additional $20 million federal appropriation has been approved for the 1987 fiscal year, but the Reagan administration has proposed forcing the city to take that money from its annual federal payment -- a position Cropp said yesterday was unacceptable.

Sen. Arlen Specter (R-Pa.), chairman of the D.C. appropriations subcommittee and a driving force behind the new prison, said he believes Congress will reject the administration proposal. Cropp said that if Congress does not, "clearly the mayor's position" on the new prison "will have to be reassessed."

Those two allocations of money -- $10 million in the current fiscal year and $20 million next year -- constitute the federal government's total financial commitment to the new prison. There is no commitment currently to the additional $20 million city officials said they will need.

Over the weekend, the city made progress in renovating a cell block that the mayor said will house 80 prisoners in Building B of the Superior Court headquarters. Downs said renovations were completed yesterday and the facility would be open by Friday for weekend prisoners, who add greatly to the crowding problem.

Superior Court Judge Greene's ruling limiting the city's ability to transfer prisoners to halfway houses came in a hearing held for Corrections Director James Palmer to show cause why he should not be held in contempt for one such transfer.

City officials had moved inmate Fernando A. Jones to a halfway house only 10 days after Greene had sentenced him to a 120-day jail term.

Palmer acknowledged on the witness stand yesterday that he had ordered the department to begin transferring certain inmates sentenced for misdemeanor offenses from the jail to halfway houses last September as the jail began to near its court-ordered population ceiling.

But Palmer testified he halted that practice after the judge's notification that Jones had been allowed to work without Greene's permission. Jones also was sent back to jail immediately.

In one terse exchange with a federal prosecutor, Palmer also testified yesterday that halfway-house inmates were permitted to leave their residence at least three times a day to eat and at other times to do their laundry, go to medical appointments, look for employment, and attend other meetings approved by corrections officials.

"Do you mean to tell me," Greene said, that inmates sentenced by the court to prison terms and "nonetheless released into the community . . . are allowed to go to other appointments, social appointments?"

Palmer said yesterday that as a result of the recent problems he had "now moved to a posture" that no one would be sent to a halfway house without first receiving court approval.