About 30 percent of all persons arrested in the District of Columbia have used cocaine recently, more than double the level of cocaine use among criminal defendants recorded just last July, according to the most recent tests in D.C. Superior Court.

The use of PCP among defendants now just barely outstrips cocaine use, at between 30 and 32 percent, said John A. Carver, director of D.C. Pretrial Services Agency, which does the testing.

"We are seeing some significant changes in the drug use patterns in the District," with cocaine use rising sharply among defendants, Carver said at hearings yesterday before the House Appropriations D.C. subcommittee on the city's proposed 1986 budget.

Last July, 14 percent of those arrested in the city tested positive for cocaine. That figure jumped to 22 percent by December and now has jumped another 8 percentage points in five months, according to the Pretrial Services Agency.

Carver said he did not know the reason for the sharp rise, though he said police have reported that the price of cocaine has dropped.

Two-thirds of all arrestees now either admit drug use or test positive for one or more of the five drugs the agency looks for, Carver said.

Defendants held in the court's cell block before arraignment are required to give a urine sample that is tested for traces of heroin, PCP, cocaine, methadone and barbiturates as part of a program begun in March 1984 to examine how drug use affects criminal behavior.

The agency does not bother to test for marijuana use among those arrested, Carver said after the hearing, because "nobody cares about it."

Later during yesterday's hearing, Rep. Julian C. Dixon (D-Calif.), the subcommittee chairman, criticized D.C. Department of Corrections Director James Palmer for a "cavalier" attitude toward testing for drug use at Lorton Reformatory.

After Palmer and officials accompanying him were unable to provide recent figures on drug use at the city's prison, Dixon responded incredulously: "This is a major issue, and nobody here knows how many in any given month are tested and what the results of the test are?" Palmer promised to provide figures for the record.

In early 1984, after press reports about drug use at Lorton, officials tested the entire prison population and found evidence that about 10 percent had recently used drugs. The mayor announced a crackdown on drug smuggling into the prison, which was to include random drug tests.

In other testimony, officials of the D.C. Public Defender Service said that District judges now are issuing longer sentences, with 80 percent of persons convicted of serious crimes being incarcerated for some period.

Charles Ogletree, PDS deputy director, said that judges have given out harsher sentences in part because of sentencing guidelines being developed by a judicial commission, which Ogletree said has resulted in "peer pressure." Some convicted persons who in the past would have received probation are now getting jail terms, he said.

One knowledgeable law enforcement official, who asked not to be named, said that view had to be "pure speculation," however.

One issue that continues to receive intense interest on Capitol Hill is the construction of a new prison in the District, currently under study, which Mayor Marion Barry agreed to under pressure earlier this year.

William D. Golightly, D.C. assistant director for administrative services in the corrections department, said the city is considering a 500-bed prison facility. This is a significantly lower figure than advocates of a new prison have discussed informally.

Five hundred beds would not take care of current prison and jail overcrowding in the District, said one law enforcement source.