Solarex Corp.'s headquarters building is in Rockville, but the company's "solar breeder" building, pictured yesterday, is in Frederick.

Standard Oil Co. (Indiana) said yesterday it had agreed to take over Solarex Corp., the financially troubled Rockville-based pioneer in the manufacture of photovoltaic cells used to change sunlight into electricity. Standard--also known as Amoco--already owns about 30 percent of Solarex.

The two companies did not announce a purchase price, but sources and company documents indicated that Amoco, the nation's sixth-largest oil company, would pay about $12.2 million for the 70 percent of Solarex it does not own already.

Amoco apparently stepped in with the takeover bid to protect its investment in Solarex after the company ran into financial problems due in part to overexpansion and the failure of solar energy to grow as fast as its promoters had hoped. Solarex lost $9.8 million last year on sales of $19.7 million.

Solarex's financial woes perhaps are illustrated best by Amoco's offering price of $2.50 a share, which is considerably lower than the $20 a share that the oil company paid when it last bought Solarex stock, last year. In addition, Solarex defaulted on a major bank loan earlier this year and had to be bailed out with a loan from Amoco, according to the company's annual report.

Gordon McKeague, Amoco's general manager for corporate development, who has overseen the investment in Solarex, said Amoco had been providing virtually all of Solarex's funding for the past couple of years.

"It's difficult to go on funding them 100 percent when you only own 30 percent of them," he said.

Amoco's takeover of Solarex would put the nation's three largest solar-photovoltaic companies in the hands of major oil companies. Atlantic Richfield Co.'s Arco Solar division last year surpassed Solarex to become the nation's largest producer of photovoltaics, and Exxon Corp.'s solar division ranks third.

Walter Ames, a Washington lawyer who is one of Solarex's 120 shareholders, said yesterday that he plans to file a suit challenging the Amoco takeover. Ames, who already has filed one suit challenging Amoco's involvement with the company, charged that Amoco has let Solarex founder. "They are now picking it up for almost one-10th of what Standard was buying stock for last December," he said.

McKeague said that Amoco avoided getting involved in the day-to-day management of the company, and thus did not have adequate control over the company's financial situation. "In retrospect, we should have paid more attention to it; we should have given management a little more attention and paid more attention to the financial management of the business," he said.

Solarex's founders, former Comsat engineers Joseph Lindmayer and Peter F. Varadi--who will continue to have "active participation" in the company, according to a Solarex press release--could not be reached for comment yesterday. Solarex President John Corsi did not return several phone calls.

Lindmayer, who had been chairman of the company, was replaced as chief executive in January by Corsi because of the company's financial woes, sources said. Corsi, who joined the company as a director in 1982, was a former executive of Analog Devices, another company in which Amoco had a financial interest, and McKeague said Amoco had "introduced" Corsi to Solarex, although he denied that the oil company had installed Corsi to protect its investment.

Last year, with much fanfare, the company opened a $6 million "solar breeder" in Frederick, Md., a solar-powered factory that was to make solar cells. The company conceded that the plant was a money-loser built chiefly to demonstrate the potential of solar-powered factories. Solarex also repeatedly has delayed plans to open a $10 million plant in West Virginia to make the raw silicon it slices and machines into solar cells.

McKeague agreed that markets had not opened up as expected. "I think the environment has changed a lot," he said. One major problem is that photovoltaic cells still have not proven to be price-competitive, in most applications, with electricity produced by conventional methods.

In spite of its financial difficulties, Solarex announced two weeks ago that it was buying out one of its major competitors, RCA Corp.'s photovoltaic business, for a price sources said was somewhat less than $3 million. The planned purchase reportedly was bankrolled by Amoco, although McKeague declined yesterday to comment on that.

The purchase of RCA's technology, which involves the manufacture of cells out of a thin film of silicon, gives Solarex two chances to crack the photovoltaic market, which some experts believe could be worth billions of dollars a year by the end of the century.