The opposition National Action Party claimed today that it was leading in vote counts for 12 of the 300 national congressional seats being contested, and it charged that only a "disastrous" fraud prevented it from winning two of the seven state governorships also at stake in yesterday's elections.

The governing Institutional Revolutionary Party, known by its Spanish initials as the PRI, claimed that it swept the governorships and said that polling irregularities were minor and typical of any elections. "They do not affect the overall result," PRI spokesman Eduardo Garcia said.

Official results will not be known until Sunday but parties can make their own tallies based on information available to their poll watchers as counts proceed.

Mexico City newspapers reported numerous allegations of ballot-box stuffing, expulsion of opposition poll-watchers from voting places, confiscation of ballot boxes and other irregularities in a variety of locations.

National Action President Pablo Madero, noting that the government had promised clean elections, charged that "this was not a democratic advance but a step backward."

National Action called for annulment of the gubernatorial elections in Nuevo Leon and Sonora, where the party mounted its most credible challenge. It scheduled a protest rally for Tuesday in Monterrey, Nuevo Leon.

The ruling party has won every race for president, senator and state governor since it was founded 56 years ago.

Serious violence flared yesterday in only one location, the border town of San Luis Rio Colorado in Sonora, where National Action supporters set fire to a police station and four private vehicles, according to party spokesmen and newspaper reports. Police used tear gas to disperse a crowd early in the day after the demonstrators opened ballot boxes to find them already stuffed with ballots marked for the PRI, newspapers reported.

The government reported that 17 demonstrators were released today in the border town after having been detained yesterday, while National Action said that 70 persons were freed today.

PRI spokesman Garcia said his party won in all 300 districts electing members of the national Chamber of Deputies, but another PRI source said that official results should be awaited for these seats. National Action's chief spokesman, Gonzalo Altamirano, said that the PRI's claim of winning in all districts "was not based on the data."

National Action triumphs in several congressional races would give a psychological boost to the conservative party, which won only one seat in the Chamber of Deputies in the last national legislative elections in 1982. The PRI was certain to retain its overwhelming majority in the legislature, and National Action clearly was disappointed by failure to win either of the two important races for governor in the northern border states of Nuevo Leon and Sonora.

National Action was the only opposition party to win a contested congressional seat in 1982. It and seven other small parties did share in a total of 100 deputies in the 400-seat chamber under a system that ensures the opposition a voice in Congress.

Complete though unofficial results showed National Action retaining its seat in the Mexico City suburb of Ciudad Satelite, and the party was well ahead in five congressional districts in the northern border state of Chihuahua, party spokesman Altamirano said. National Action supporters shot off firecrackers to celebrate the apparent victories in Chihuahua's largest city, Ciudad Juarez, just across the border from El Paso, Tex.

The National Action spokesman also said that unofficial tallies gave his party a lead in three districts in Mexico City, and three in central Jalisco State. "The vote was very good in Jalisco," a longtime conservative political stronghold, Altamirano said.

Mexican press coverage and witnesses' accounts suggested that polling irregularities were particularly severe in the state of Nuevo Leon, whose capital is Monterrey, a northern industrial center. The PRI's campaign chief in the state, Sen. Norberto Mora Plancarte, conceded that much of the public thought there was fraud and that this presented "a problem for the system." But he contended that "these [problems] are normal for any electoral process anywhere."