On a sultry summer afternoon at Fort Meade, the marching drill is already in progress. Three dozen first year, junior ROTC cadets are confounded by the machine-gun succession of the commands and, in a Woody Allen-style spoof of a military docudrama, they stary to march resolutely in opposite directions.

While thousands of teen-agers in the Washington area are busy learning the latest dance steps this summer, these youths are learning how to waltz -- military style -- on a makeshift dirt dance floor behind barracks on Chisholm Road.

The decade or more since students demonstrated to protest U.S. involvement in Vietnam has been witness to a dramatic shift in attitudes toward the military among American youths. And that was nowhere more evident than in the summer ROTC program for high school students sponsored by the Prince George's County school system and the U.S. Army that came to a close at Fort Meade yesterday.

For two weeks 91 Prince George's teen-agers woke up at 5 a.m. to go running, pass inspection, attend classes and briefings, go on field trips and, in short, go military. The attractions of the military for these teen-agers are education, skilled trades and travel -- free.

"This two-week training here will give you an idea of whether or not you want to go into the military, you know, getting up at 5 o'clock and the pressure and the aides," said 17-year-old Yvonne Anderson of Landover. "ythey [the military] have so many benefits that you can get, like if we don't go into the military, we have to pay for rent and electricity and food and travel. But the Air Force will pay for all that."

In 1966, Oxon Hill High School started the first junior ROTC chapter for Air Force cadets in Prince George's County. Northwestern High School in Hyattsville opened the only ixisting one for Navy cadets that same year.Six years later, Laurel and Largo high schools opened Air Force chapters, too. Currently, Largo has the largest branch in the Washington area and the second largest in the nation.

Now there are five more ROTC high school units at Bladensburg, Gwyn Park, Duval, Central and High Point high schools with a total enrollment of 1,500 students, and this fall a 10th chapter will open at Suitland High School.

"Because of high unemployment, young folks are saying to themselves that the military may not be such a bad career, and that ROTC may enable them to take advantage of benefits after high school," said Martin McNulty, a retired Air Force lieutenant colonel who is one of six summer instructors at Fort Meade.

In 1974, William Reynolds, a retired Air Force colonel, opened the first summer camp for Prince George's County junior ROTC students at Andrews Air Force Base with 26 cadets and two instructors. A year ago, the cadet corps moved to Fort Meade because it had outgrown the available space on the air base. The 91 cadets in the program, one of two in Maryland, paid $90 in tuition and lab fees and will receive one full credit toward their high school diplomas.

In this simulated military life, students also compete for outstanding flight, or team, on the basis of academic performance, athletics and leadership capability. In one class, "we were learning about civil aviation," said Ross Beverley, 16, of Hyattsville. "[Lindbergh] flew from New York to Paris [in 33 1/2 hours in 1927]. "He flew by himself. He did all his own refueling."

As part of the athletic field day competition, for example, the students had to run about 60 yards to aides holding baseball bats, place their heads on the upright bats, whirl themselves around 10 times and run back to their teams, usually running sideways and falling down in this hysterical game called dizzy izzy.

Daily scheduled events included briefings with military personnel at Fort Meade and several visits to Andrews Air Force Base for helicopter flights, a canine demonstration, a security police briefing and observing pilots in an altitude chamber for physiological training.

If there was one common complaint about the program it was the demerit system.

"They get me on punctuality," said Darryl Bullock, 17, of Landover, who had 26 demerits. "I don't have any."