All 2.5 million men and women in the armed services, including recruits, will have their blood tested for exposure to the AIDS virus, military spokesmen said yesterday.

The costly program will be one of the largest infectious disease screening projects ever undertaken, as well as one of the most controversial.

Military officials say they are carrying out the tests to combat a serious health problem -- the spread of AIDS, the deadly acquired immune deficiency syndrome that destroys the body's ability to fight disease.

But critics note that relatively few military personnel have AIDS and charge that the screening is designed to harass male homosexuals -- a group at high risk from AIDS -- into leaving the armed services.

Details of the massive screening are to be announced next week, a Pentagon spokesman said.

In broad outline, it will cover recruits and active-duty personnel in the Army, Navy, Marines, Air Force, Coast Guard, service academies, military reserves and officer-training programs, officials said.

It has not been determined how often those on active duty will be tested.

Critics charged that the military's decision is a misuse of the test, which was not developed as a diagnostic tool.

The test indicates exposure to the AIDS virus by detecting the presence of AIDS antibodies. A person who tests positive does not necessarily have the disease.

Researchers have estimated that only 5 percent to 20 percent of those who have been exposed to the virus will eventually develop AIDS.

Military personnel who initially test positive for signs of AIDS antibodies will get another, more precise and more expensive test.

Those who test positive for the antibodies but who show no signs of the disease will be put on limited duty, counseled and monitored for further developments, according to military officials.

"The very, very small percentage of those found to have actual AIDS disease would be given medical treatment," said one official. "But nobody would be forced to leave the service."

About 115 cases of AIDS have been reported in the Army, Navy and Air Force, but those numbers are incomplete.

Estimates of how many military personnel will test positive in the new screening range from about 1,000 to 10,000.

Cases of AIDS disease itself are expected to number a few hundred, one official said.

The cost of screening all personnel and caring for those with the disease is expected to be high. Testing for 328,000 recruits each year will probably cost $4 million to $5 million, according to Defense Department spokesman Lt. Col. Peter Wyro, and counseling and medical treatment for those who test positive or who develop AIDS will add millions more.

"In the worst situation, there are estimates it will cost $500,000 per case for the medical care program," Wyro said.

Another Pentagon official cautioned against "hysteria and overreaction" about the screening.

"We want to be sure military people and their families are aware of the AIDS problem," he said. " . . . It's merely a case of dealing with a new disease . . . . "

But critics were not reassured.

"The military is riding the crest of a public panic, and using that to get this test through," said Harvey Friedman, a Washington lawyer who has handled several cases of military men with AIDS and homosexuals who have sued the military to win benefits. "Ferreting out homosexuals from the military, that's been their dream. Now they've got what looks like a magic wand."

Rules of confidentiality between doctor and patient in the military are different from the absolute and automatic ban on disclosure that civilians enjoy.

Navy policies, for example, require Navy doctors to report homosexuals to military authorities, according to a Navy spokesman.

Friedman said that in three of his cases, Navy doctors later told their superiors about the patients' homosexuality after promising the information would be kept confidential. Those cases occurred before the Navy issued a policy in August saying information gained in questioning related to the AIDS antibodies testing should be kept confidential between doctor and patient.

The Pentagon's Lt. Col. Wyro said the Defense Department may revise its policies on confidentiality to cover concerns about the mass screening program.

"Currently, information is released to commanders in only a very few cases," such as soldiers involved with sensitive weapons, he said.

Testing among recruits has already begun this month at the nation's 72 military induction centers.

In San Diego, 11 Marine Corps trainees and an unknown number of Navy recruits whose initial blood tests showed exposure to the AIDS virus are being kept in quarantine at the Naval Training Center until final tests are performed at a private Bethesda laboratory, military sources said.

"If a recruit has a medical indication of the potential for an infectious disease, DOD policy is to isolate the individual," Wyro said.

If a more sophisticated test shows the newly recruited individuals have AIDS antibodies, indicating possible exposure to the disease, he said, "they simply have no military obligation."

Positive test results for recruits will be made available to civilian health authorities if the military is asked for them, according to a policy announced last week by Dr. William Mayer, assistant secretary of defense for health affairs.

Army officers at some induction centers had offered to give local health departments the names of recruits who tested positive so the individuals could be given counseling. Mayer said the names could be given only after a formal request.