A federal appeals court in Richmond has upheld a lower court's ruling that a handicapped youth cannot be expelled from the Prince William County school system for his involvement in a drug deal because his behavior was caused by a learning disability.

The decision of a three-judge panel of the 4th U.S. Circuit Court of Appeals, released yesterday, affirmed the earlier decision in which a U.S. District Court judge attributed the behavior to the handicap because, he said, the youth was easily swayed by peer pressure into acting as a go-between in a drug transaction.

The youth was 14 when he was expelled from the Rippon Middle School in February 1983. School authorities said he had served as an intermediary for two nonhandicapped students who wanted to buy drugs.

School officials said that the youth's role in the transaction had nothing to do with his handicap, which involved a difficulty in understanding and analyzing written and verbal expression.

After Prince William County school officials expelled the youth, his parents appealed the decision to the state Department of Education, which reinstated him. U.S. District Judge Albert V. Bryan Jr. in March 1984 upheld the state education department's decision to reinstate the youth. The School Board then appealed the case to the higher court in Richmond.

Now 16, the student is still in Prince William County schools.

Gerard S. Rugel, an attorney for the youth, said yesterday that the decision "indicates the learning disabled child's rights to be looked at individually before he is expelled."

He criticized the School Board for allegedly wasting time and money on the case.

"The money could have been better spent on educating handicapped children rather than fighting them" in court, Rugel said.

County school officials yesterday could not produce figures on the cost of pursuing the case through four hearings and two federal court cases during a two-year period.

Prince William School Board Chairman Gerard P. Cleary said he disagreed strongly with the court's ruling.

"I can't buy the rationale that just because it's a special-ed kid you've got to give him some rights that other kids don't have" in disciplinary cases, Cleary said.

Cleary added that the School Board "will continue to take a strong stand on drug and alcohol abuse in the county schools."

In the ruling, the appeals court agreed with Bryan's opinion that the youth "leaps at a chance for peer approval. He is a ready 'stooge' to be set up by peers engaged in drug trafficking."

The appeals court ruled that a school system may expel a handicapped student if his behavior is not linked to his disability.

But in the case of the Prince William County student, the court said, the school system should have either changed his school placement or imposed a less severe punishment than expulsion.

The court also dismissed as "illogical" the School Board's argument that if the student had been placed in an appropriate educational program, then he could be expelled.