When Mark R. Hagerott left his Seattle home four years ago to enroll in the U.S. Naval Academy in Annapolis his friends thought he was "a little bit unusual."

"I guess the Vietnam legacy was still there," said Hagerott, who is now preparing to be graduated to a Rhodes scholarship and a career as an officer on nuclear-powered ships. "Now when I go back, it's unbelievable the amount of interest in the Navy--people are kind of kicking themselves they didn't take the opportunity I did."

While the U.S. military continues to debate how best to attract able recruits to its volunteer Army, the elite and rigorous officer-training academies are enjoying boom years.

Spurred by hard times and apparently growing respect for the military, more young men and women applied to the Naval Academy this spring than any time in the past decade. Admissions officials at the Army's academy at West Point and the Air Force Academy in Colorado are enjoying similar popularity.

"I'd say 'Officer and a Gentleman' is winning out over 'Lords of Discipline,' " joked Lt. Col. Larry Thacker, director of cadet admissions at the Air Force Academy, referring to two recent Hollywood films that gave audiences dramatically different portrayals of the life of an officer trainee. "There's just a much better attitude toward the military now."

Thacker said that he has received 37,000 inquiries from prospective students this year, compared with 32,000 last year. The U.S. Military Academy at West Point had 12,677 applicants this spring, compared with 11,044 in 1981 and 9,180 in 1979. Applications to the Naval Academy are up 9 percent from last year, to 13,570, with female and minority applications at a record high, according to academy spokesman Dennis R. Boxx.

Naval Academy officials and students said that, with parents worrying about cuts in federal student aid and young people anxious about finding work after graduation, the academy's promise of a free education and a guaranteed job is attractive.

Several graduating midshipmen said, however, that money does not entirely explain the lure of the academies at a time when the college-bound population is dwindling. They said their former high school classmates respect their uniforms, marvel at their sense of class unity and envy their well-defined futures.

"Two of my best friends still don't know what they want to major in," said Hagerott, 22. "They're having a great time, but I think they're beginning to regret they didn't have a little more direction. They look at me and say, 'You know where you're going.' "

The Naval Academy has begun offering some options in classes and majors to respond to the increasingly complex scientific needs of the Navy. And the most infamous forms of physically hazing freshmen "plebes" are no longer allowed.

But the cloistered campus on the Severn River remains an isolated, restricted world, where every hour must be accounted for and weekend dating is a privilege for upperclassmen.

In fact, in response to increased freedom in the outside world, which has reverberated faintly within Annapolis during the past several years with minor but unprecedented sex and marijuana scandals, the academy's training has become, if anything, more restrictive.

"At first I thought it was all a little childish, squaring corners and saying cheers," recalled Jacqueline Y. Blackwell, 24, who served two years in the Navy before coming to Annapolis. "It took my two roommates during that first summer to tell me I wasn't as mature as I thought I was."

Blackwell joined the Navy, she said, after realizing that she would need years to work her way through a Baltimore community college and prepare for a civilian career.

"We were the younger brothers and sisters of the people who'd been in Vietnam, and they were the ones who would tell me to stay away," Blackwell recalled. "But for me, I wasn't without direction. I was without means."

Blackwell was one of 80 blacks and 90 women in her entering class of 1,403, and she intended to join the nuclear branch of Navy service. She soon learned, however, that nuclear-powered submarines, like most surface ships and many of the glamorous flying assignments, are off limits to her because Congress has barred women from any role that might put them in combat. So Blackwell chose aviation mechanics.

"I did a cruise over the summer, and I had the best time," Blackwell said. "But I know for me to get assigned to a warship, it's never going to happen, because it's a warship. That is very frustrating."

Cheryl A. Dolyniuk, an Arizona native who also will be graduated this spring, is the Naval Academy's first female regimental commander. She is in charge of more than 2,000 fellow midshipmen. A varsity athlete in three sports, Dolyniuk said that she has decided to become a pilot. But to reach her goal of flying jets, she must become one of the two women the Navy allows into the "jet pipeline" in any year.

The choices are broader for men. Unlike during some past years, according to an Annapolis spokesman, the Marines easily made their quota this spring. The nuclear-powered submarine branch, which had to draft graduating midshipmen into its difficult program in 1980, also got all the volunteers it needed this year.

Despite the technical training required and many months spent undersea, serving on submarines is popular again, Annapolis midshipmen said. The submarine program pays more and prepares its graduates for lucrative jobs if they choose to leave the Navy. But the midshipmen said there also is more to this than money.

"That would most likely be the most applicable defense situation we're going to have if the situation ever arises," said Stephen P. Recca, 22. "They're the best deterrent we have."

Recca's comment reflects the paradox several midshipmen said they face as they prepare to assume their duties as naval officers. Hagerott said none of his classmates wishes for war, yet many were stirred by the film clips of last year's British-Argentine fighting over the Falkland Islands.

"I don't think there's anything that compares to the excitement of a sea battle, the invigoration," Hagerott said. "It is kind of terrible to train and work all this time--and to know that if you ever fire, you've failed."