The Pentagon spends a fortune putting people through medical school so the military hospitals of this country can be staffed by competent doctors. But, increasingly, the best are bailing out of the service as soon as their obligatory stint is finished, and the lure of big money in private practice is not the only thing that drives them out.

Physicians in the military are finding out that serving their country can be tantamount to second-class citizenship. You have heard the stories of abysmal treatment in military hospitals. This is the flip side of that story viewed through the eyes of the doctors, who are denied basic civil rights.

Many are whistleblowers who are harassed when they try to expose gross negligence in military medical care. Others are victims of personal vendettas by commanding officers who think a hospital can be run like boot camp and a doctor can be browbeaten like a foot soldier. When these harassed doctors complain, they are denied the due process afforded private citizens.

We reported recently on the all-too-common phenomenon of perfectly sane military doctors who are forced into psychiatric treatment simply because they complain about their working conditions. Pending legislation introduced by Rep. Barbara Boxer (D-Calif.) would make it illegal for the military use psychiatry to punish whistleblowers. But the ingenious military can make doctors suffer by allowing personality conflicts with commanding officers to spill into personnel records and evaluations.

The Pentagon has formal procedures for a doctor to appeal a bad rating, and the military may sanction an investigation. But one lawyer told us, ''If you're looking for the military to make your case for you ... don't count on it.''

Civilian life begins to look mighty good to a frustrated doctor, but it isn't always easy to shake the bad rap and make that transition. The Pentagon has recently agreed to add the credentials of its physicians to a National Practitioner Data Bank, which private hospitals can check when deciding whether to hire a former military doctor. Negative ratings, deserved or not, will go into those files.

Doctors who stick it out with the military complain that their reputations are often smeared through no fault of their own. In one case we examined, the federal government paid more than $1 million in compensation to a patient who sued a military hospital for malpractice. (Military personnel are barred from suing military doctors, but civilians, such as dependents, can sue.)

In this case, no one asked the two doctors involved whether the settlement was justified. In fact, until recently, four years after the suit was filed, neither doctor was aware of the charges against them or allowed a chance to defend themselves. The military simply sewed up the messy case into a neat settlement to avoid the hassle, no matter what the consequences to the reputations of the doctors involved.

One senior military official told our associate Dean Boyd that by his conservative estimate, 10 percent of the military malpractice cases are settled without bringing the doctors into the decision.