The world’s richest man, perhaps reflecting on his own success, pronounced himself baffled by what’s keeping more students from going into computer science. Microsoft Chairman Bill Gates was speaking July 18 at the annual Microsoft Research Faculty Summit in Redmond, Wash. He addressed nearly 400 computer science professors from 175 schools in 20 countries on the software maker’s campus.

Even if young people don’t know that salaries and job openings in computer science are on the rise, Gates said, they’re hooked on so much technology–cell phones, digital music players, instant messaging, internet browsing–that it’s puzzling why more don’t want to grow up to be programmers.

“It’s such a paradox,” Gates said. “If you say to a kid, What are the 10 coolest products you use that your parents are clueless about, that you’re good at using,’ I don’t think they’re going to say, Oh, you know, it’s this new breakfast cereal. And I want to go work in agriculture and invent new cereals or something.’ … I think 10 out of 10 would be things that are software driven.”

Maria Klawe, Princeton University’s dean of engineering and applied science, who was sharing the stage with Gates, said most students she talks to fear that computer science would doom them to isolating workdays fraught with boredom–nothing but writing reams of code.

Gates said computer scientists need to do a better job of dispelling that myth and conveying that it’s an exciting field.

“How many fields can you get right out of college and define substantial aspects of a product that’s going to go out and over 100 million people are going to use it?” Gates aked. “We promise people when they come here to do programming … they’re going to have that opportunity, and yet we can’t hire as many people as we’d like.”

Citing statistics from UCLA’s Higher Education Research Institute, Klawe said students’ interest in computer science fell more than 60 percent from 2000 to 2004, even though salaries have increased and more jobs have opened up.

Klawe opened an hour-long question-and-answer session with Gates by asking him what he thought could be done to stem a decline in federal funding for computer science research and graduate education.

In past three years, she noted, the Defense Department’s research agency–a major source of money for computer science academics–has cut its funding for information technology research at universities almost in half.

The National Science Foundation is awarding a smaller percentage of grants for computer science than for other fields, she said.

Gates said Microsoft and other high-tech companies need to keep telling the government it’s making a big mistake–one that could forestall stunning advancements in medicine, environmental science, and other fields. He also said companies can help by boosting their own investments in research and development.