The young woman at the center of a controversy that led nuclear physicist Andrei Sakharov to stage a hunger strike was briefly detained today as she was preparing to travel to Gorki, the city 250 miles east of here where Sakharov has been exiled.

Two plainclothesmen seized Liza Alexeyeva, 26, outside a railway station and hustled her into a black sedan. According to her friends, she was driven to a spot about 15 miles outside Moscow while agents warned her against traveling to Gorki or trying to contact the physicist by telephone.

Alexeyeva, released well outside the city limits by the agents, returned home three hours after she was detained.

Later tonight, Alexeyeva described her encounter, saying the agents told her that "if I was smart I would take their advice."

She said that she told the agents, "I think I will try again to go to Gorki, and soon." Although police warned her last year not to visit Gorki, she said she had gone there twice this year.

The warning to Alexeyeva came after the authorities yesterday ended the protest by Sakharov and his wife, Yelena Bonner, by forcibly taking them into a hospital on the 13th day of their fast.

The physicist, who helped develop the Soviet hydrogen bomb but whose subsequent advocacy of human rights has made him the country's foremost dissident, had vowed earlier that he would not halt his hunger strike unless Alexeyeva was allowed to join her husband in the United States.

Her husband, Alexei Semenov, is Sakharov's stepson, currently a graduate student at Brandeis University.

There was speculation here that Alexeyeva was picked up by police as a prelude to her expulsion from the Soviet Union. Friends of Sakharov here dismissed such speculation as unfounded.

Diplomatic sources said they believe that the Soviets may expel Sakharov and his wife because they cannot tolerate an indefinite regimen of forced feeding.

"He's going to remain a constant pain in their side in any other eventuality," one diplomat said.

Alexeyeva had been visited daily by two American diplomats since the beginning of the Sakharovs' hunger strike. She was planning to visit Gorki in an effort to determine the state of their health.

There has been little word on Sakharov's health in the official media. An English-language Moscow radio broadcast said he was receiving "the best medical attention and is in excellent health."

Alexeyeva yesterday tried to reach Anatoly Alexandrov, president of the Soviet Academy of Sciences, of which Sakharov is one of the most illustrious members. Although Alexandrov refused to see her, an aide quoted him as saying that he had done everything he could to help Sakharov. The aide also quoted Alexandrov as saying that Alexeyeva should go to Gorki to "settle" the hunger strike.

Before she was released, three of Sakharov's friends sent a telegram to Alexandrov asserting that Alexeyeva was "forcibly seized" as she tried to follow his "advice." They contended that if Alexandrov was "responsible for his words" he should use his influence to obtain the young woman's release.

The government newspaper Izvestia last night bitterly criticized Sakharov for attempting to turn his personal family problems "into a cosmic crisis."

Izvestia also presented Alexeyeva's case in terms of a love triangle. After Semenov emigrated to the United States four years ago, his wife Olga Levshina and their child joined him under the provision of "family reunification." The couple has since divorced.

The paper quoted from a letter by Alexeyeva's parents, who are opposed to her leaving the country.

"Our daughter is being intensively brainwashed in an anti-Soviet spirit by Sakharov, Bonner and company with the aim of forcing her to leave the Soviet Union," it said.

Alexeyeva was married to Semenov in a proxy ceremony in Montana last summer. The Soviet Union does not recognize such marriages, however.