About 40,000 supporters of the opposition National Action Party marched in the northern city of Monterrey last night to protest the election loss of their candidate for state governor in a vote marred by irregularities.

The rally was the largest of several that have been staged by National Action, a conservative party, this week to protest what they called widespread fraud by the governing Institutional Revolutionary Party, or PRI, in last Sunday's vote.

The governing party was prepared to concede that National Action won between four and 10 seats in the Chamber of Deputies out of 300 at stake in the election, according to Mexican newspapers and opposition sources. That would be a record number of seats for the opposition, which won only one deputy's seat in the last congressional elections in 1982, but it would be far below National Action's claims to have won more than 30 seats. Official results are to be released Sunday.

It was impossible to determine how well National Action would have fared in an election completely free of irregularities. Most opinion polls conducted before the election indicated that the ruling party would win, although it was leading some races by narrow margins.

It was clear that the PRI padded its totals substantially in the two northern border states of Nuevo Leon, whose capital is Monterrey, and Sonora. National Action is strong in those states, and the influential posts of state governor were at stake.

Diplomats here, and Mexican and foreign journalists who covered the elections, said that the ruling party scarcely bothered to conceal irregularities on voting day in Nuevo Leon and Sonora. Witnesses reported seeing expulsion of opposition poll watchers from voting places, voting by persons who lacked proper credentials, exclusion of National Action voters who had proper credentials and discovery of ballot boxes stuffed with ballots already marked for PRI candidates.

The ruling party said it had won all 300 deputies' seats, and the seven state governorships at stake in the election, shortly after the polls closed and before significant results were available. National Action has proposed annulment of the elections in Sonora and of nearly half of the results in Nuevo Leon through legal channels, but the ruling party controls the commissions that rule on the elections' validity.

"What surprised me was the obvious crudity of how they conducted it," a West European diplomat said. "It seems to me that they were making the point very deliberately that there should be no doubt about who is in charge," he said.

Results released by the ruling party showed that National Action's gubernatorial candidate in Hermosillo, capital of Sonora, had not received a single vote in his home town. "This would mean that my family did not vote for me," Adalberto Rosas, the candidate, said.

National Action said it won all 10 deputies' seats in Chihuahua State, and an official of a left-wing opposition party said the conservatives' victory in Chihuahua was "undeniable."

"We saw the figures at each of the precincts," Avelino Soto of the Mexican Unified Socialist Party said. "It bothers us that people have chosen a party to the right, the reactionaries, but as an honest political party we must demand that the vote be respected."