RIO DE JANEIRO, Brazil (AP) _ Two years ago, Brazil switched on its Angra I nuclear-power plant and proudly joined a select circle of nations with atomic energy.

But before long, Brazilians were calling it ''the lightning bug'' because it kept going on and off.

After repeated shutdowns of the 626-megawatt plant, Brazil now is suing the U.S. manufacturer, the Westinghouse Electric Corp., on grounds of fraud and breach of contract. Officials here claim Angra I's design was flawed from the start. Westinghouse has denied the charges.

''We are demanding payment for repairs, expenses and an indemnization. The defects are in design and manufacture,'' said Marcio Costa, director of nuclear production at Furnas Centrais Eletricas S.A., the government power company that runs Angra I.

The flaws do not compromise safety, Costa said, but are costly, embarrassing and shorten the active life of the plant, at the seaside resort of Angra dos Reis, 95 miles southwest of Rio de Janeiro.

''Angra I was supposed to last 40 years,'' he added in an interview. ''But our experts say it won't last even half that long.''

Since the plant began tests in 1982, it has closed down more than 20 times for repairs of various kinds.

Then this past June, a short circuit caused part of the electric generator to melt and automatically shut the plant down.

Costa said repairs will take at least six months. He estimated the cost in lost energy at $3 million a month.

In a statement, Westinghouse said the cause of the generator breakdown was unknown but it claimed there was no evidence of wrongdoing on its part.

On July 10, the New York law firm of Shereff, Friedman, Hoffman and Goodman filed suit against Westinghouse in the Federal District Court of New York on behalf of Furnas, charging there were structural defects in the steam generator.

Costa said Furnas now is considering filing another lawsuit because of the breakdown in June.

Construction on Angra I began 15 years ago, during Brazil's ''economic miracle,'' a period of rapid development in the late 1960s and early 1970s.

Angra I was a so-called ''turn key'' package, meaning Westinghouse would not transfer technology to Brazil but would deliver the plant complete and ready to run.

But there were problems. Scheduled to start up in 1977, the plant was not considered ready for tests until 1981. The final cost was six times the originally projected $300 million.

Until 1983, the plant was prohibited from running at more than 50 percent capacity, while Westinghouse technicians searched for a solution to the nagging mechanical failures.

''They specified equipment that was totally inadequate for salt water,'' Costa said. ''We would disassemble pumps and there wouldn't be any rotor left, just the tip of the axle, because the sea water had corroded it all away.''

Finally in 1984 the plant tested at 100 percent capacity, and it entered commercial operation the next year. But in 1986 it stopped again for the replacement of corroded condenser tubes.

Meanwhile, Brazil's nuclear program has been put back.

A plan to build up to eight 1,300-megawatt West German reactors was scaled back to two. Now even those have been paralyzed. Angra II is an empty shell, while Angra III is not beyond site preparation.

Still, Brazil considers nuclear energy important for its future.

''Deactivating Angra I would not be in the national interest,'' Costa said. ''Nuclear energy is cheaper than hydroelectricity.''

The president of Furnas, Joao Camilo Penna, said, ''Angra I is worth a billion dollars, and we can't throw a billion dollars into the sea. Even rich nations don't do that, and we're not rich.''