Foreign students, who used to give an international flavor to a few choice American campuses, are now here in numbers large enough to be giving colleges nationwide a case of indigestion instead.

And as the U.S. birthrate declines, alien scholars are likely to be a major factor in shaping the future of American higher education.

Fully 235,500 foreign students are believed to be attending post-secondary schools from coast to coast, getting more than their share of high grades and advanced degrees, demanding and obtaining curriculum shifts that suit their needs.

Though they are only 2 percent of the nation's 11.4 million college students today, it is estimated that foreigners will be 10 percent by 1990. At that 1 million level, they could mean survival for many colleges that might otherwise have to close.

The number also means problems of adjustment on all sides. Who picks the students who will come and how are they matched to the right schools? How much should they pay, and should state governments help out? What if a small college becomes dependent on them? How will all this affect what colleges teach?

"I'm afraid things are getting out of hand," said Kenneth A. Rogers, director of foreign student services at the University of Indiana in Bloomington. He directs a National Association of Foreign Student Affairs (NAFSA) project that is trying to evaluate the impact of the quiet invasion soon enough for colleges and universities to make it a blessing rather than a problem.

Five years ago, he said, many experts predicted that foreign enrollment would decline as tuition costs skyrocketed here. But no one foresaw the sudden wealth of oil-rich nations and their determination to pick America's technological brains.

Nations of the Organization of Petroleum Exporting Countries (OPEC) accounted for nearly one-third of foreign enrollments last year, with 36,220 students from Iran leading the way, according to the Institute of International Eduction in New York.

Asian countries eager to know and penetrate U.S. markets have sent their scholars, too, to make up about half the total. The top 10 among the 175 countries with students here, after Iran, are Taiwan (13,650), Nigeria (13,510), Canada (12,600) and Hong Kong (12,000), followed by India, Japan, Venezuela, Vietnam and Saudi Arabia.

More than 30 percent of these students are studying engineering. The rest lean heavily towards business and management courses, with social and natural sciences making up the remainder.They get 15 percent of all Ph.D. degrees, compared to 3.5 percent awarded to another minority. American black students, and 30 percent of all graduate degrees in engineering according to the National Association of Graduate Schools. Clearly the foreign students are serious.

"They will become the most influential members of their own societies," said Mary Ann Spreckelmeyer of the International Communications Agency, the government public relations branch that tries to give U.S.-bound students some idea of what to expect. "Certainly the U.S. government has begun to pay more attention to them."

The colleges began paying attention first Facing a projected 15 to 20 percent drop in the number of American high school graduates in the mid-1980s, the institutions of higher learning are looking for ways to guard against closedowns.Most estimates see a resurgence of the U.S. student crop in the 1980s and it has become a question of hanging on until then. Foreign students are an obvious part of the solution.

"Here we are with a lot of empty (college) seats and sitting on the largest balance of payments deficit in our history," said James Johnston, who runs a foreign student recruiting office in Philadelphia. "International economics tells you that we should specialize in what we do best-the export of education and technology."

Each foreign student, besides filling an otherwise empty seat, brings in about $5,000 per year, for a total of more than $1 billion nationwide in foreign exchange. His or her tuition, like that of any student, pays only 10 percent of a public college's operating expenses (34 percent at private schools), but the school benefits in other ways from the alien presence.

The University of Minnesota tried to figure what the foreign students were costing the campus but couldn't, according to foreign student adviser Joseph Mestenhauser. He said the students were used in an "invaluable" cross-cultural program involving history, language and other classes for American students.

At Indiana University, officials decided the international studies office cost each of its 1,700 Bloomington campus students $25, but noted that alien and out-of-state students paid $75 per cent credit hour to go there.

All this has fostered some feelings of guilt over the way foreign students have been treated in the past, coupled with some willingness to make changes in the future. Educators worry that some of the changes could be for the worse.

"Some schools have been inventing programs out of thin air" to draw international students, Rogers said, while others will promise to begin a program if the students enroll. He cited one two-year junior college that had admitted foreigners seeking engineering degrees, typically a four-year-plus course.

"That's not an isolated incident," Rogers added. "It's out-and-out fraud."

In addition, institutions eager for paying pupils occasionally have pushed foreigners into studying something that wasn't much use back home. "American faculty are a bit guilty that in the past they have paid little attention to what the foreign student could do with his education," said Marvin Baron, foreign student adviser at the University of California in Berkeley.

In a study for NAFSA, however, Baron found that fully one-third of 1,500 colleges surveyed said they would be willing to adapt their curricula to the needs of foreign students today. Two-thirds approved the idea of allowing dissertation research in the home country.

The difficulty is that graduate schools are particularly expensive. "These programs are hard to defend at the state legislature when budget time comes," said Francis Finn of the National Association of College and University Budget Officers. Legislators often question whether taxpayers' dollars should go to support programs that benefit non-Americans primarily.

Foreign students also are often perceived as disruptive elements, demonstrating, as Iranian students recently did, for faraway causes that rural college towns care nothing about. There have been riots and bad feelings in several areas, and at least one school, Trinidad State Junior College in Trinidad, Colo., closed down after repeated clashes between local residents and the alien students.

It isn't easy to come up with any kind of organized response, however, since the students are dispersed across the country and there is no one place coordinating or even studying the situation. "No one is quite sure what will happen, but these will be challenging times in the '80s," said Finn. "There's turmoil out there."