Harold C. Lyon Jr., the former director of federal education programs for gifted children, was sentenced yesterday to nine months in jail despite his pleas to a Virginia judge that he committed three sex-related misdemeanors because he suffers from a mental illness that caused him to be "addicted to sexual gratification."

Lyon's statement during a five-hour hearing before Arlington Chief Circuit Court Judge William L. Winston was echoed in testimony from a Johns Hopkins University psychiatrist, his attorneys, his ministers and his wife. They argued unsuccessfully that Lyon should not go to jail but should be placed on probation and allowed to perform community service by working in a nursing home.

Prosecutor Henry Hudson had urged that Lyon be sentenced to one year in jail on the charges of aiding illicit sexual intercourse that carry a three-year maximum prison term.

A West Point graduate and former Army officer who became a nationally known educator, Lyon has written three books emphasizing sexual liberation and self-awareness.

Last October he was arrested on pimping and prostitution charges by Arlington detectives who answered an ad Lyon placed in Met Personals, a sex-oriented Washington tabloid, on behalf of the wife of a former State Department official, offering sex in return for money. Lyon pleaded guilty in January to the misdemeanor charges as part of a plea bargain.

"My career is totally destroyed, my reputation as a psychologist and educator are ruined," said Lyon, a 47-year-old former Education Department official. He said he has "been waiting six months to make a statement about this and those six months have been the most dramatic, most difficult time I've faced."

Lyon, who is eligible for parole after serving six months, clenched his fingers as he stood before the judge and apologized for "promoting a life style I now know is a sickness."

"Money was never my motivation," said Lyon, who likened his illness to alcoholism. "I would have paid to do what I did and I did pay a lot of money," he said, thanking the detectives who arrested him for "stopping me before my life went further down the drain, if possible."

Dr. Fred Berlin, director of a program for sex offenders at Johns Hopkins University in which Lyon is enrolled, testified that the life of the Middletown, Md., man has been dominated for years by "a preoccupation with a variety of bizarre and unusual sexual desires."

According to Dr. Berlin, Lyon is currently being treated with a powerful hormone called Depo Provera that he described as "a sexual appetite suppressant." The drug has been known to cause a variety of possible side-effects including weight gain, hypertension and phlebitis.

Lyon, Dr. Berlin testified, is responding well to drug and other therapies and should be spared a jail sentence in order to continue treatment. "His difficulties don't involve children or victims," Dr. Berlin said. "He's his own biggest victim."

Lyon's wife said her husband has changed greatly since he entered the Hopkins program and began seeing two Methodist ministers for counseling. Before his arrest, said Edith Lyon, staring at her hands and blinking back tears, "I didn't see any way Hal's behavior was going to be changed."

Edith Lyon said that the couple has seven children, ranging in age from 18 to 27, and mortgages on their home totaling $143,000. Lyon, the sole support of his family, retired from his $50,000-a-year government post last December, but his lawyer said he has not received his pension.

Prosecutor Hudson argued that Lyon should serve a year in jail. "The medical problem would not have caused him to desire to profit," said Hudson, who accused Lyon of running "a commercial sex operation."

At the request of Lyon's attorney, Winston agreed to permit Lyon to remain free on $5,000 bond until May 17 when he is scheduled to begin serving his sentence.