New York Mayor Ed Koch, whose city has long been a target of anticrime forces, took a swipe at Washington this week. A suggestion that alternatives to prison might be appropriate for some imprisoned burglars and weapons offenders is "one of the jerkiest proposals" he had ever heard, Koch told reporters.

But Mayor Marion Barry defended yesterday alternatives to prison terms for some convicted criminals, though he would not specify which ones and refused to say whether some imprisoned burglars and weapons offenders should be candidates for these programs.

"I happen to believe that prisons and cells are not always the answer to rehabilitation or a deterrent. I think studies have shown that right down the line," Barry said at his monthly news conference.

Koch took the opposite view on alternatives to prison and rehabilitation efforts.

"There are people who believe that jail is not the answer, that rehabilitation is . Now it is conceded by almost everybody that rehabilitation does not work," Koch said at a press luncheon Monday held by Godfrey Sperling of the Christian Science Monitor. "So my feeling is that until we find that pill that rehabilitates, put 'em in jail."

Barry was responding to questions about a controversial prisons report he sent recently to CapitolHill, which stated that "there is nothing inherently dangerous or violent about the offense of burglary " and that "weapons offenses are technically victimless." The report suggested that alternatives to prison might be appropriate for some persons imprisoned for these crimes.

Barry said his administration is still developing policy on the issue and that the statements in the report represented one "very, very liberal" approach.

"I'm not yet ready to say what all those categories for alternatives are," Barry said.

"I do know what some of them are not: I do know that people who commit murder and rape and felonious assault and armed robbery and who are drug dealers . . . will never get any support from me for any alternatives to incarceration," he added.

On weapons offenses, he said he personally believes that possession of a weapon is "technically not violent or dangerous" but that no one except law enforcement officials should carry weapons.

Barry refused to state whether he considers burglars "inherently dangerous."

The report has drawn harsh criticism from law enforcement officials who have read it, including D.C. Police Chief Maurice Turner, who said that all kinds of burglaries are inherently dangerous because of the potential for violence.

When asked for his opinion, Barry would say only that all persons who commit crimes should be arrested, prosecuted and convicted and that "the only question is what happens beyond that."

Koch, on the other hand, referred to burglary as a "crime of violence" and said that freeing people from criminal attacks is the country's "No. 1 priority."

He said he would reduce funding for all other priorities "if it required that to build the jails and to maintain them."

But Barry said the public is inconsistent about what it wants, that citizens are clamoring for tougher sentences but will not support the tax increases necessary to build more prisons.

"The same public that says we need to build more jails and we need to hire more correctional officers and more police officers," Barry said, "if you say to that same public, 'That's fine, we have to have a $40 million tax increase to pay this $40,000 per cell, this $16,000 per year to keep someone incarcerated, this $25,000 average salary we pay police officers, will you take a tax increase?' This same public would say no."