President Reagan joined in a salute to 298 of the Washington area's top high school seniors yesterday, and wound up defending his administration's spending on education and his support of tuition tax credits and school prayer as he briefly fielded questions from the students.

It was the second time in three days that Reagan focused remarks on his belief that the nation's public schools are failing to properly educate the nation's youth. Yesterday's remarks came at a "Best of Class 1983" program sponsored by WDVM-TV and General Motors.

The crowd was sweltering under a tent pitched on the grounds of the U.S. Naval Observatory north of Georgetown as Kurt Hirsch, an 18-year-old senior at Walt Whitman High School in Montgomery County and the student member of the county's school board, asked his question.

"I want to ask you about the impression that people have that your administration has done more to tear apart the public school system through such programs as tuition tax credits, demolishing the Department of Education and cutbacks in federal funding for education," Hirsch said.

In reply, Reagan said that there have been no actual cutbacks in public education funding. He said that the "total spent on education is $116.9 billion, and that's 7 percent more than last year and that's double what was spent just ten years ago on education."

Later, deputy White House press secretary Peter Roossel told reporters that the $116.9 billion figure represents the "total expenditures in the nation's public schools this year," including funding by state and local governments.

Reagan added that his support of tuition tax credits is based on "a belief in competition."

"The parents of children who are going to those independent or parochial schools and paying tuition are also paying their full share of taxes to support the public schools," he said. "It isn't going to hurt the public schools. There's nothing going to be torn away from them."

Therese Stoal, a senior at Langley High School in Fairfax County, asked how Reagan could support public school prayer, given the traditional separation of church and state.

"I think we have to keep in mind that we are a nation under God," Reagan said, "and if we ever forget that, we'll just be a nation under."

Aside from the president's appearance--which came as a last-minute surprise to the students, who had expected the major address to be delivered by Barbara Bush, wife of the vice president--it was a day for the graduating seniors to accept the congratulations and praise of the event's sponsors, gorge on a catered lunch, and tour the observatory.

One of the lighter moments of the day came when sportscaster Glenn Brenner of station WDVM-TV announced that Reagan would not be giving a speech; the students promptly applauded.

In conjunction with television stations in several cities around the country, GM is sponsoring similar fetes for a total of 7,000 high school seniors from 5,000 schools. The students at yesterday's activities were recommended by their teachers and counselors and included students from as far away as Loudoun and Charles counties.

Security was tight. Joseph R. White Victorian, a senior at Armstrong High School in the District, said that he had to remove all of his high school buttons to get through a metal detector.

"We appreciate the ceremony," said Victorian, president of Armstrong's senior class. "Something like this doesn't happen every day."

Amy Bemish, who said that she had maintained a 3.949 (out of 4.0) grade average at J.E.B. Stuart High School in Fairfax County, was not about to let a torn ligament in her knee keep her from the ceremony--she arrived on crutches.

"It's a nice honor," said Bemish, who will major in computer science at James Madison University in the fall.

"It's very worthwhile. A lot of us work hard, but we don't get the recognition that high school athletes always get," said Evelyn Johnson, a 17-year-old senior at Northwestern High School in Hyattsville.

"We are going to use you as role models in hundreds of television spots," said Edwin W. Pfeiffer, vice-president and general manager of station WDVM (Channel 9). "We're very proud of you."

"The country needs the talent here today," said General Motors president F. James McDonald. "You can be very proud of what you have achieved so far."