Microsoft Corp. Chairman Bill Gates said yesterday the software giant is having enormous difficulty filling computer jobs in the United States as a result of tight visa restrictions on foreign workers and a declining interest among U.S. students in computer science.

Speaking on a technology panel at the Library of Congress, Gates said a decline in the number of U.S. students pursuing careers in science and technology is hurting Microsoft in the short run, and could have serious long-term consequences for the U.S. economy if the problem is not addressed.

"We are very concerned that the U.S. will lose its competitive position. For Microsoft, it means we are having a tougher time hiring," Gates said. "The jobs are there, and they are good-paying jobs, but we don't have the same pipeline."

Microsoft conducts 85 percent of its research in this country. "We are very tied to the United States" when it comes to doing research and development on the company's Windows and Microsoft Office products, he said.

Gates called on the Bush administration and Congress to relax visa restrictions so more foreign workers could be hired to fill technology jobs. Tighter restrictions on foreign workers were imposed after the Sept. 11, 2001, terrorist attacks.

Gates said visa restrictions are keeping too many bright, educated people from working in the United States. "A policy that limits too many smart people coming to the United States is questionable," Gates said. "The visa issue doesn't make sense."

Rep. David Dreier (R.-Calif.) defended the visa restrictions, saying they are driven by the responsibility of the federal government to protect U.S. citizens from terrorism. He said the Microsoft chairman's description of the problem ignored the harsh realities of fighting foreign terrorist threats.

"We still have to focus on border security," said Dreier, who also appeared on the technology panel. "We can't be so naive."

Shirley M. Tilghman, president of Princeton University, said during the discussion that a significant part of the problem is that U.S. schools, including universities, discourage girls and women from sticking with subjects such as math, science and engineering. With women making up more than half of all U.S. college graduates, she said such discouragement translates into a lack of trained computer science and technology talent.

"Too often," she said, of both male and female students, "by the time they get to us, they are math-phobic or science-phobic."

Richard F. Rashid, senior vice president of Microsoft Research, said he recently told his son, who is an undergraduate studying computer science, that he would have plenty of jobs to choose from when he graduates.

"We're hiring as many people from college campuses as we can, but there are just not enough of them available," Rashid said.

Gates said the combination of tighter visa restrictions and increasing opportunity in rapidly growing economies in China and India means that more foreign students who study at U.S. universities are returning home to work, rather than seeking jobs in the United States. China, he noted, is generating four times as many new engineers annually as the United States.

The Microsoft chairman said rapid growth in China and India also expands the opportunity for U.S. companies to sell products on world markets. But he said the nation risks losing competitive ground to these economies over time if the dearth of scientific talent translates into a great erosion of the traditional U.S. advantage in software and technical innovation.

"There is no doubt that the U.S.'s relative position will decline even if we do all the right things," Gates said.