San Diego — A young sailor gulped down the shrimp salad on his mess tray, then turned his attention to the broiled halibut. ''We don't always eat this well, you know,'' he told a civilian at his table. ''It's just because you visitors are aboard. They're trying to make Navy life look good. But we have real problems.''
The problems, he said, involve illegal drugs - and what the Navy is doing about them. The sailor was especially worried about the Navy's get-tough policies. Officers have told their crews, in effect, to ''shape up or ship out.''
Another sailor, a petty officer, told this unhappy story: A few days before, he was tested for drug use. Traces of marijuana were found in his body even though, he claimed, he never used it.
How could this happen? The petty officer explained that he had spent the previous weekend ashore with his girl friend. While he was with her, she had smoked ''pot'' frequently. He had apparently inhaled the fumes, he claimed, which had been absorbed by his body. Now he expected to be reduced in rank and possibly given other punishment. His Navy career, which had been bright, now looks threatened.
Seven hours later, a visitor sits across the table from a young commander, crisp in his Navy whites. They are dining on fork-tender beef at the officers' club - and the visitor relates the story of the petty officer. The commander is unsympathetic.
''That's a sad story,'' he says. ''But it's probably just that - a story. We are not going to have drugs on our ships. Drugs could jeopardize the safety of the ship, the crew, the entire fleet. My advice to that young petty officer would be: 'Get another girl friend.' ''
Such are two sides of one of the most difficult battles now being waged by the Pentagon: the battle to force America's soldiers, sailors, and airmen to shake the illegal drug habit.
It's a battle that senior officials happily talk about because they think they are winning it.
On July 1, the struggle will intensify. The US Army will begin subjecting officers and enlisted personnel to far tougher rules.
In the past, Army policy has focused on rehabilitation for its drug users. The new policy:
* For officers and senior enlisted personnel, a single proof of illegal drug use could result in discharge.
* For junior enlisted personnel, second-time drug offenders will be thrown out of the service.
* Army men and women in sensitive occupations will be required to undergo at least one unannounced test for drugs every year.
These stern Army policies will bring that branch into line with what is already happening in other services.
So far, the results of the Pentagon crackdown have been encouraging. A new study, due for release next month, indicates that the number of junior enlisted men and women who smoke marijuana at least once a month has dropped from 37 percent in 1980 to 22 percent today. One drug fighter in Congress cautions, however, that the military is ''only in Round 3 or 4 of a 15-round struggle with this problem.''
To a great extent, of course, the military's drug problems reflect American society today. The Marine Corps' experience illustrates this. Even before they arrive at Marine boot camp here, young men are warned by recruiters that any drug use could result in immediate discharge. And as they arrive for basic training, signs greet them with the message:
Marine Corps policy on drugs! 'Drugs will not be tolerated'
Yet during the first week of processing here in San Diego, about 10 percent of incoming recruits are found to have drugs - mostly marijuana - in their bodies. They are immediately sent home.
The services' firmer stance began in 1981. It immediately raised complaints - and cheers.
The complaints came from those worried about invasion of privacy, and from dangers of inaccurate tests that, they said, could result in the innocent being hurt. Some also asserted that alcohol was a worse problem than illegal drugs.
Cheers came from those worried about military readiness - and from the danger of putting lethal weapons into the hands of doped-up troops.
The military's drug problems had sprung into public view in May 1981, when a Marine Corps EA-6B Prowler jet crashed on the deck of the aircraft carrier Nimitz.
The crash, an investigation showed, was caused by pilot error. But autopsies found that 6 of the 14 people killed on the ship had been using marijuana. Although the use of marijuana was not a factor in the crash, the public was startled.
Adm. Thomas Hayward, then-chief of naval operations, soon launched a new policy allowing ''zero tolerance'' for drug abuse. He warned users: ''Not on my watch, not in my division, not in my Navy.''
Action was swift. Discharges for drug abuse rose from 11 officers and 466 enlisted men in fiscal year 1981 to 23 officers and 2,022 enlisted men in fiscal '82.
Is all of this fair to the troops? Are the tests always accurate?
Pentagon officials don't claim perfection. But they explain that they have an extensive system of testing, retesting, backup procedures, and other methods that they claim reduce the risks of improper identification to a negligible level.
It is possible, officials concede, to have ''passive inhalation'' of marijuana show up in a person's tests. But officials say they have set standards to err on the side of caution. No one - such as the petty officer mentioned above - could inhale enough marijuana smoke to register as an actual marijuana user himself merely by being in the same room with other smokers.
Officials also address the question of alcohol abuse and why it is different from drug abuse. Alcohol, notes one official, is a legal beverage. Drugs such as marijuana and cocaine are not. Thus, he points out, drug abusers are lawbreakers , and that is reason enough to oust them from the service.
At the same time, officials say that alcohol abuse is being looked at more sternly than in the past. In the Navy, for example, the number of persons discharged for alcohol abuse rose from 188 in fiscal year 1981 to 386 in fiscal year 1982.
On Capitol Hill, a staff expert on drug problems had mostly praise for all of these military efforts.
''The Navy and Marine Corps have been doing a good job,'' he said. ''But the public should not be surprised at the seriousness of the situation. We have drugs in the military for the same reasons we have them in our factories, our schools, and our playing fields. So long as drugs are available - and acceptable - you are going to have people using them.''
The military's main problem, he says, is the availability of drugs. They are far more widespread today in Europe - in Britain, West Germany, and Italy - than they were a few years ago. They are also easily obtained in the US. Furthermore, illegal drugs are almost always available on military bases and on many ships at sea, especially large ships.
''There are no places in the world today, expect perhaps the two poles, where the military serves and where drugs aren't present,'' he says. ''That's something the military must contend with if they are to be successful.''
Yet from Army bases in Europe to carriers in the Pacific, the picture is steadily brightening - and that has greatly encouraged just about everyone grappling with America's drug explosion.