Six D.C. high school students, four of them from McKinley High in Northeast, were indicted yesterday by a federal grand jury here on drug selling charges that stemmed from an undercover investigation in which police officers spent several months in schools posing as students.

The six -- and a 19-year-old Roosevelt High School student indicted April 1 on charges of selling cocaine -- are the first District students to be charged under a new federal law that provides for prison sentences of up to 30 years for each count of selling drugs within 1,000 feet of a school.

The McKinley students, all 18 or 19 years old, were arrested at the school April 17, and each was charged at the time with one count of selling PCP. The indictments issued yesterday charged each of the four with two to seven counts of selling marijuana and PCP.

U.S. Attorney Joseph E. diGenova said last night that the indictments were a "very important symbolic effort as well as a real effort to make it clear that drug dealing near schools or in schools will not be tolerated."

Prosecutors said the alleged sales occurred in or near McKinley, at Second and T streets NE, and that many took place during school hours.

DiGenova said he, D.C. Police Chief Maurice T. Turner Jr. and D.C. School Superintendent Floretta D. McKenzie were involved in setting up the undercover operation, which placed officers masquerading as students in at least three high schools.

"It had become readily apparent to everyone that there was a tremendous amount of drug dealing going on in the schools," diGenova said.

He said he could not disclose specifics of the undercover program because other indictments are expected, but sources said the officers had been in the schools for much of the current school year. The indictments allege that the sales took place from last September to January.

D.C. school officials could not be reached for comment last night.

"We decided to use all legal techniques in these schools to fight drug dealing," diGenova said, calling such techniques "appropriate and necessary."

The new federal law, part of the 1984 Comprehensive Crime Control Act, is aimed at reducing what has become a widespread problem of drug dealers congregating near schools and pressuring students to buy drugs.

Last summer, five persons were indicted under the law in connection with alleged sales of the painkiller Dilaudid near Garnet-Patterson Junior High School at 10th and U streets NW.

"To those who perceive these charges as heavy handed," diGenova said, "I suggest that they go into the schools where teachers and principals are fighting to maintain civility and decorum so they can do the business of education."

DiGenova said two other McKinley students arrested April 17 on drug charges are juveniles and face juvenile proceedings. Those indicted yesterday, he said, "are more than adults within the view of the law. If they can sell drugs, they can do the time."

DiGenova also praised the work of undercover police officers James Simpson, who was assigned to McKinley, and Arthur Brooks Jr., who was assigned to Roosevelt.

The four McKinley students indicted are:

*Guy Q. Johnson, 18, of 228 Hamilton St. NW, charged with three counts of selling marijuana and three counts of selling PCP.

*Kevin L. Harrison, 19, of 1839 24th St. NE, charged with two counts of selling marijuana and two counts of selling PCP.

*Gregory Stallings, 18, of 4907 12th St. NE, charged with three counts of selling marijuana, three counts of selling PCP and one count of selling cocaine.

*Major Unger, 19, of 111 Franklin St. SE, charged with one count of selling marijuana and one count of selling PCP.

Two of the six indicted students attend another D.C. high school but neither had been arrested as of last night, prosecutors said. Their names were not made public.

The Roosevelt student was identified as Clark R. McKnight, 19, of 1220 Trenton Place SE. He was indicted April 1 on a single count of selling cocaine within 1,000 feet of Roosevelt High School at 13th and Upshur streets NW. His trial on the charges is set for June 5 before U.S. District Judge Thomas P. Jackson.

Law enforcement sources said that when one of the McKinley students was arrested he was wearing an electronic beeper, a communications device investigators say has come into increasingly common usage among members of drug distribution networks.

The four McKinley students are all free on personal recognizance and had returned to school, which was among the factors that prompted the D.C. school board on Friday to approve a new policy that allows the superintendent to transfer, without a hearing, students charged with criminal offenses.