An undercover narcotics investigation that used young police recruits posing as students to infiltrate Washington high schools has resulted in the arrest of 18 students on drug-related charges in the past three months, D.C. police said yesterday.

Seven arrests were made this week at Ballou High School in Southeast, eight last month at Eastern High in Northeast, and three at Roosevelt High in Northwest in January, according to police familiar with the investigation.

Warrants have been issued for three other Ballou students, police said.

Authorities said most of the offenders were male students between the ages of 16 and 22, mostly in their respective senior classes. Each of the students arrested this week has been charged with one or more counts of selling marijuana, and some of the earlier arrests involved charges of possession of phencyclidine, a powerful drug also known as PCP or "angel dust," said police investigators.

D.C. school officials said this week that they knew of only nine drug-related arrests in city schools since October, but school system records only include arrests that take place on school grounds and some of the apprehensions did not occur on school property, said police. Shelton Lee, director of security for the public schools, said his records show nine arrests this fiscal year and eight last year.

Police familiar with the investigation said 15 arrests were made in the past three months and 25 arrests during the last academic year, September 1981 through June 1982.

A recent survey of Maryland schools reported that drug abuse has been on the decline there. D.C. police believe the same trend is occuring here, in part because of increased costs for drugs and greater knowledge among students about the effects of drug abuse.

But narcotics officers and school system officials still view drug use as a significant problem, and both said that the recent arrests were only the tip of the iceberg of a problem that is difficult to quantify. "We leave 10 for every one we get," said one narcotics officer.

"If it is in the community it is in the schools. Police can't cover every nook and corner and neither can we," Lee said. "We really don't know how much of a handle we have on it."

"I think this is a very serious problem," said William H.L. Brown, chairman of the D.C. Congress of PTAs, who also serves on the system-wide Safety and Security Advisory Group that monitors, among other things, drug problems in the city's schools. "One of the problems in making arrests is that youngsters have a code of ethics of their own and do not tell on each other. Those that do lose credibility with their peers."

Police said they have used the same "fake student" method of making arrests for the past 13 years. The recent undercover investigation involving five youthful-looking police academy recruits began last September in five schools, police said. Investigations at two high schools have produced no results, police said.

"We have a problem getting officers who look 18 years old. You have to sell yourself and the students are skeptical of them," said a narcotics officer.

D.C. narcotics officers, citing the example of one student charged last year with selling PCP and marijuana who is back in school this year, have expressed frustration over seeing some students return to school after arrests for selling drugs.

School board member John E. Warren (Ward 6), whose ward includes Eastern, said he appreciated the officers' frustration, but added that if courts release youngsters or place them on probation they cannot be barred from returning to school.

"It's a joint problem between the police, the courts and the schools," he said.

"I don't really know what happened to those kids who were arrested ," said Lee. "If they keep their noses clean we don't get into the act anymore." Of the cases of students who were arrested on drug charges last year, Lee said: "Most have returned to school, I suspect."