"Two years from now, spam will be solved," he told a select group of World Economic Forum participants at this Alpine ski resort. "And a lot of progress this year," he added at the event late Friday, hosted by U.S. talk show host Charlie Rose.
Gates said Microsoft, where he has the title of chief software designer, is working on a solution based on the concept of "proof," or identifying the sender of the e-mail.
One method involves a human challenge, or requiring the sender of an electronic pitch to solve a puzzle that only a flesh-and-blood person can handle. Another is a so-called "computational puzzle" that a computer sending only a few messages could easily handle, but that would be prohibitively expensive for a mass-mailer.
But the most promising, Gates said, was a method that would hit the sender of an e-mail in the pocketbook.
People would set a level of monetary risk - low or high, depending on their choice - for receiving e-mail from strangers. If the e-mail turns out to be from a long-lost relative, for example, the recipient would charge nothing. But if it is unwanted spam, the sender would have to fork over the cash.
"In the long run, the monetary (method) will be dominant," Gates predicted.
He conceded, however, that his prognostications have not always been on the mark. Notable misjudgments include the rising popularity of open-source software, epitomized by Linux, and the success of the Google search engine.
"They kicked our butts," he said, while promising a better next-generation Internet search engine from Microsoft, due as early as next year.
At the forum itself, Gates announced a partnership with the United Nations to bring computer technology and literacy to developing countries.
Drawing on a $1 billion Microsoft fund, the U.S. software giant will work with the U.N. Development Program to provide software, computer training and cash to establish computer centers in poor communities, starting with pilot projects in Egypt, Mozambique and Morocco.
Gates told a news conference the centers would not have to use only Microsoft products.
Egypt's minister of communication and information technology, Ahmed Mahmoud Nazif, welcomed the help, noting that about 500 to 600 centers have already been set up in Egypt.
Gates told the smaller group he thought Microsoft's team of software engineers was outrunning the hackers that have caused havoc by unleashing increasingly destructive viruses to attack networked computers. But he said it was tough to stay ahead. "If only the bad guys would just do the same stuff they did last year," he moaned.
While the Windows desktop operating system has become a "very powerful standard," he said Microsoft was more open today about its source code to allow other companies to develop competing products. That was partly due, he said, to the rise of Linux and antitrust actions in the United States and Europe.
Gates said he had not met with European Union antitrust commissioner Mario Monti, who is also attending the forum in Davos, but would be willing to if it would help settle the long-running EU antitrust case against Microsoft.
EU regulators charge that Microsoft's decision to tie its Media Player into Windows, which runs about 90 percent of desktop computers, "weakens competition on the merits, stifles product innovation and ultimately reduces consumer choice."
They are threatening fines that could reach up to $3 billion, as well as a far-reaching order for Microsoft to strip the multimedia application from Windows to give rivals such as RealNetworks' RealPlayer or Apple's Quicktime more of a chance.
"We're doing what we can to come to some amicable settlement," Gates said.
After three days of hearing last November, the European Commission is expected to issue its decision early this year.