The U.S. “diversity visa” program — 50,000 green cards allocated by lottery each year to applicants who need only a high school education to qualify — has been generating embarrassing headlines lately. Shortly after notifying this year's lottery winners — out of nearly 15 million applicants — of their entitlement to move permanently to the United States, the government discovered a computer glitch that produced erroneous results. (Instead of a random drawing, 90 percent of the winners were from entries submitted on the first two days of the 30-day registration period.) The government told the winners, who likely were busily severing their ties to families, friends, jobs and communities in preparation for their imminent move to the United States, that their visas were rescinded. A redo of the lottery is scheduled for Friday.This latest spectacle of government incompetence and broken promises, causing mass upheaval and crushing hopes that the government itself had raised, is all too familiar — think of Hurricane Katrina's aftermath and the failed mortgage relief program. But the visa fiasco obscures a more fundamental objection to the program: It was misconceived at its inception.Immigration is in many ways the lifeblood, future and salvation of an aging, technology-driven America. The stakes could hardly be higher in getting our immigration policy right and bringing in those who can provide what we need: skills, entrepreneurs, close family members and investment.A green card to the United States is one of the most valuable pieces of paper in the history of the world. So why would we want to give roughly 5 percent of them each year to people who, for all we know, have nothing more to offer America than a high school education, a winning ticket and (in many cases) an agent they paid to help them game the lottery system?No sensible public policy would do such a foolish thing. Instead, like other immigrant-receiving nations, we should handpick our immigrants (refugees aside) with a view to our national interests and the individual attributes that they bring to the table. In contrast, the diversity lottery, like most wasteful programs, reflects four dubious characteristics: powerful friends in Congress, a superficially appealing but spurious rationale, a supposed free ride for taxpayers and status quo inertia.The program was created in the late 1980s by Sen. Edward M. Kennedy, D-Mass., and some other members of Congress to gain legal status mainly for people from Ireland who had overstayed their visas and were here illegally. This “temporary” program was promoted as diversity-enhancing: As it evolved, lottery participants would be limited to people from countries that had recently supplied relatively few immigrants. This feature, along with the lottery's randomness, gave the program an ostensibly egalitarian cast. But this was largely illusory.Kennedy made sure that it included Ireland — which, of course, had sent large waves of immigrants here decades ago and so had little justification for special visas now — and that another law ensured a minimum allotment for Ireland. He also saw to it that the law treated Northern Ireland as a separate qualifying country. (Eventually, a significant portion of the lottery winners were from Africa — almost half last year. Africans do increase national-origins diversity, but our immigration stream has long been so remarkably diverse that we hardly need to boost it with randomly distributed visas.)This program imposes a cost — an opportunity cost: These visas would otherwise have gone to applicants who met more demanding, individually applied criteria. Finally, the program, like so many other bad policies, proved easier to create than to dislodge; it has remained on the books for more than 20 years. The fact that some of the 50,000 lottery winners will turn out to be desirable immigrants is an accident, not a policy.The solution is straightforward: Abolish the program and use those 50,000 visas (or more) to promote carefully defined national interests, particularly in more high-skilled immigrants who, many studies show, produce jobs, innovation and new businesses. After all, these visas are permanent, not temporary, as with the H1-B visas.Indeed, this would be an opportunity to experiment with two new ways to improve visa allocation. First, the government could auction some visas to the highest bidders, just as it auctions scarce broadcast spectrum. The winners are likely to be either employers willing to pay for needed skilled workers or individuals who can finance their bids based on their ability to create value and thus earn good incomes in the United States. The auction proceeds could be used for job-training programs for low-skilled or unemployed workers, or for other social needs.A second experiment would allocate some visas through a points system — long used by Canada and elsewhere (and even considered by Kennedy) — that awards points for English fluency, job skills, family or other ties to American society, and other predictors of successful assimilation, with visas given to those with the highest point totals.These approaches promise to teach us more about which kinds of legal immigration reforms can best advance our national interests. Leaving those interests to chance is a bad gamble.Peter H. Schuck, a Yale Law School professor, is co-editor (with James Q. Wilson) of “Understanding America: The Anatomy of an Exceptional Nation.” He wrote this for The Los Angeles Times.