"I am getting a raw deal." onetime police officer James W. Kegley says now after one more in a series of losing battles with the D.C. Police Department.

Thirty months ago Kegley went on sick leave, and then took a construction job. Undercover officers filmed him at work, and he became the first city policeman fired for malingering.

Kegley, 34, says all he wants to do now is go back to works, which is impossible because the department has fired him. In that case, he says, he wants to be retired on disability, since doctors have said he sustained a disbling knee injury in the line of duty.

On Thursday, however, the city retirement board turned down his disability application for the second time.

"I can't beleive what is happening to me," Kegley said in tones of resignation. "I was on leave without pay. I had to support my family. "You can ask my supervisor - I'm a good cop.

His case, one of the more bizarre to come before the city retirement board, according to board members, is yet another illustration of the difficulty of determining eligibility for disability retirement. The stakes are high: a tax-free pension - worth hundreds of thousands of dollars over a lifetime - or nothing.

In 1974, while climbing a building to help a woman who had locked herself out of her apartment, Kegley twisted his knee. He reported to the police clinic, underwent surgery, and returned to duty.

In November 1975, Kegley said the knee began hurting and locking on him and he went on sick leave. De. Stamford A. Lavine, an orthopedic surgeon, found that Kegley was permanently disabled and recimmeded that he not go back to regular police work.

Kegley applied for sick leave with pay and the police department turned him down, ruling that his injury did not occur in the line of duty. He went on sick leave without pay.

At that point, early 1976, his knee was locking an average of three times a week, he later testified. It was upredictable, painful, and took contortions to get the knee unlicked, he said, but otherwise he was able to function almost normally.

Nevertheless, Kegley claims, he asked to return to light duty, and police doctors refused. The doctors say they have no written notes or recollection of such a request.

In April 1976 Kegley took a job with a construction company. "I was on leave without pay," he said recently. "My car repossessed. I had a wife and three children to support."

The police internal affairs unit, acting on a tip, followed Kegley for two months secretly filmed him lifting cinder blickjs, bags of mortar and pushing a wheelbarrow of wet cement up a steep incline."

Meanwhile police doctors agreed with Lavine that Kegley was permanently disabled from policy duty, and that as a policeman his trick knee represented a potential danger to himself and others.

In August 1976 Kegley appeared before the Police and Fireman's Retirement and Relief Board. Doctors recommended him for retirement on disability. Kegley told the board he really would rather be a policeman. The board then voted that he was not disabled, and Kegley prepared to return to work.

Before he could put on a uniform, the police department notified him he was suspended pending a trial board on charges of malingering. He was found guilty in November 1976.

Kegley appealed to the major. Fourteen months later, the mayor upheld the trial board. The length of time it took to decide the case was in part a result of a backlog of cases, a situation that will not be allowed to happen again, according to Martin Schaller, the mayor's executive secretary.

Kegley was on leave with pay during the appeal, and resumed construction work after the major ruled against him.

Once officially fired, Kegley asked for a rehearing before the retirement board. "as long as my knee doesn't lock I can be a policeman," he told a reporter moments before the hearing. "I'd go back and try it tomorrow if they'd let me."

During the hearing last Thursday, Dr. Albert Rolle testified that he no longer necessarily believed that Kegley was disabled, because since his original testimony he had found out that Kegley wanted to return to work.

"Motivation is 75 per cent of these cases," Rolle said "The individual's perception of his injury . . . is awfully important. - What he says he can or cannot do is more important than mu findings."

Rolle said a number of policemen have what appears to be serious medical problems on X-rays, but continue to work anyway. "There are people walking around and we say, 'My goodness, how is he doing it?' The point is they are doing it," Rolle said.

Deputy Chief John Breen, the fire department representative on the board, asked Rolle to reconcile his new opinion with an excerpt of his testimony from the first hearing.

According to the transcript of that hearing a board member has asked Rolle:

Doctor . . . you've heard Officer Kegley and states that he wants to return, that he enjoys being a police officer and would like to return to duty, but he does have a problem with the locking (of the knee), do you still consider him to be disabled?"

And Rolle had replied, according to Breen's reading of the transcript:

"I would hate to be officer Kegley's partner in a squad car and get into a situation where I need him and he's running to help me and he locks. And I don't think I could risk even riding with him that way. So that as far as performance of full police duty, yeah, I would recommend that he is disabled."

Asked by Breen Thursday if that was not a contradiction, with his new position, Rolle said, "I seem to have contradicted myself, that's for sure." He offered no other explanation.

Police Internal affairs officers then appeared at the hearing and showed videotape of Kegley lifting heavy wheelbarrow on a construction site. The board voted 5 to 1 that Kegley was not disabled.

Had he been found disabled, he would have received two-thirds of his pay tax-free for life.

The board's decision "is completely contrary to the evidence," Kegley's attorney, Charles Schulze, said Friday. "There is not question that Kegley has a permanent disability as a result of his knee locking.Who the hell is internal affairs to come in and say it's not so, or anyone else for that matter. This is really outrageous conduct by the police department."

Board members normally do not discuss any part of their decision, or even their vote. A reporter was allowed to attend the hearing Thursday with the permission of Kegley and Schulze.

Sources close to the board said afterward that at least one board member who sides with the majortiy found it inconceivable that Kegley could be unfit for police duty, but could work construction.

Board members have said privately that a better definition of disability is needed. "Are we going to retire a man on probability or possibility that his knee will lock?" asked one board member. 'What is disable from all police duties, or just some police duties?" Court interpretations of the law, board member have said, are contradictory and confusing.

Board members on both sides of the vote said the case could have been decided more equitably if the board could have granted Kegley a pension that was a percentage of his salary in porportion to the injury, say 10 to 20 percent for his damaged knee.

Kegley said he would appeal the retirement board's latest decision to the District of Columbia Court of Appeals.