After two years of making three-dimensional drawings with computers, Michael Hyman, a 18-year-old high school senior from Ellicott City, Md., visited the White House yesterday to hear President Reagan talk about the importance of science and math.

"He was neat," Hyman said as he walked down the White House driveway after meeting Reagan along with 39 other finalists in the 42nd annual Westinghouse Science Talent Search."I began to think about all this and do it two summers ago when I saw a Three Stooges movie in 3D in Baltimore. It's great that it helped me get here."

Later last night Hyman's computer graphics project was named the second-place winner in the prestigious nationwide contest. He received a $10,000 scholarship.

The first prize winner--with a $12,000 scholarship--was Paul Chih Ning, 16, from the Bronx High School of Science in New York City. Ning presented a sophisticated paper in number theory. He said he thought much of it through in "two very concentrated months," including a few nights when he stayed up working until dawn.

"I just set a certain goal for myself and got it done," Ning said. "I didn't want to stop."

Yesterday's 20-minute visit with the president and the awards dinner at the Mayflower Hotel last night ended five days in Washington for the high school science contest finalists.

"It's really great being treated as a Very Important Person and being rewarded for your work," said Ning, who was born in Taiwan. "Every student should try it."

Since the contest began during World War II, five of its winners have gone on to become Nobel Prize winners. Two others have won the Fields Medal, the equivalent of a Nobel in math.

The contest was started out of a wartime concern with improving U.S. performance in science and math. In the past few years the same concern has waxed again. This time it is tied mainly to the economic competition the United States faces from Europe and Japan, said officials of the Science Service, a nonprofit group that conducts the talent search with funds from Westinghouse Electric.

Despite the high quality of the winning projects, E. G. Sherburne Jr., director of the Science Service, said some of the signals from the contest are not good.

Over the past decade, he said, the number of entrants has dropped steadily along with the nationwide decline in high school test scores. This year the drop was the sharpest ever--a 13 percent decline from a year ago to 824 completed entries.

The most immediate reason, Sherburne suggested, was the end of National Science Foundation support for summer science training programs for high school students. These programs have been on university campuses for the past two decades and have produced many of the winners in the Science Talent Search, he said. With no federal support the number of students involved dropped by almost half last year.

Sherburne said the contest may also have been hurt by the slack economy as more students may have been forced to take summer jobs.

The 40 finalists came from 16 states and Puerto Rico. Eleven are foreign born, including nine from Asia and two from Eastern Europe. Nineteen live in New York, among them 12 who attend New York City public schools. Six of the latter attend Bronx High School of Science, which selects students from throughout the city.

Eighteen finalists were female, the highest proportion ever, and two were black, the first time there has been more than one black finalist in a single year.

Besides Hyman, the only other finalist from the Washington area was Douglas Morgan, 18, a senior at McLean High School in Fairfax County. His project was a study of beer samples for cancer-causing agents called nitrosamines.