Mexico will allow International Business Machines Corp. to build microcomputers here in a wholly-owned subsidiary that the government previously had rejected because it would compete with Mexican-controlled firms, the president's office announced this evening.

U.S. corporations and the U.S. government were expected to welcome the action as a signal that Mexico, in the interest of attracting foreign investment, is willing to yield on some of its nationalist, protectionist concerns. Mexico's rebuff of IBM in January was seen at the time as a serious setback to this country's efforts to obtain capital from abroad.

The Foreign Investment Commission accepted a revised IBM proposal, presented in May, to invest $91 million over the next five years in a project to manufacture "System 51" microcomputers, a government communique said.

The new plan included several changes from the original IBM proposal. In particular, it provides for IBM to introduce its most advanced products in Mexico within six months of their commercial introduction in the United States, according to the communique.

The "compromise," as a senior Mexican official called it, also required that prices for the IBM microcomputers made and sold here could be no more than 15 percent higher than prices in other countries for the same products, according to the communique. The document said that IBM was obliged to develop a network of Mexican-controlled companies as suppliers for the microcomputer plant, although its language seemed vague on this point.

Mexican law normally bars foreign companies from owning more than 50 percent of companies here, but the government allows exceptions to this rule in certain industries that it is trying to develop.

"IBM made new proposals that fit in more with Mexico's policy on foreign investment," the senior Mexican official, who asked to remain anonymous, said. "They will encourage Mexicans to build plants to supply parts for the microcomputers," he said.

The microcomputer plant is to be the largest of its kind in Latin America.

The announcement was made too late in the evening here to obtain reaction from IBM.