Feodor Fedorenko, accused of lying about his World War II activity as a concentration-camp guard, was in federal custody in New York yesterday, waiting to become the first alleged Nazi-era war criminal deported from the United States to the Soviet Union.

Fedorenko, whose deportation has been sought by the U.S. government since 1977, was picked up Wednesday in Philadelphia hours after two Supreme Court justices turned down his final appeal to halt deportation.

Justice Department sources said federal officials hoped that Fedorenko, 77, a native of the Ukraine who asked to be deported to the Soviet Union, would depart Wednesday night on a flight to Helsinki and Moscow.

The sources said that Fedorenko missed the flight and is to be put on the next available plane with a guard representing the U.S. Marshals Service or the Justice Department's Office of Special Investigations, which prosecutes Nazi-era war criminals residing in this country.

Neal Sher, director of the special investigations office, said the Soviets have agreed to accept Fedorenko, the Associated Press reported.

A member of the Soviet army, Fedorenko became a German prisoner of war in 1941 and was made a guard at the concentration camp in Treblinka, Poland, where about 800,000 people were believed murdered.

At several U.S. court proceedings, the government produced witnesses who said Fedorenko shot Jewish prisoners after making them crawl naked on hands and knees; chased women into gas chambers, beating them as they went, and carried a steel-tipped whip to beat prisoners on arrival at the camp.

Fedorenko entered the United States in 1949, authorities said, but did not mention his concentration-camp activity. He worked for more than 20 years as a laborer in a Connecticut brass foundry, became a citizen in 1970, retired to Miami in the mid-1970s and later moved to Philadelphia.

Although U.S. authorities cannot prosecute Nazi-era war criminals for their activities, they can seek deportation if a person is found to have lied about his background while trying to enter the United States.

In 1977, the Immigration and Naturalization Service sued to strip Fedorenko of citizenship on grounds that he lied about his wartime activities. The INS lost the case.

In 1979, Allan Ryan Jr., who until recently headed the special investigations office, appealed and won. The U.S. Court of Appeals revoked Fedorenko's citizenship.

Fedorenko appealed to the Supreme Court, where Benjamin Civiletti argued the government case in his only appearance before the high court as attorney general. In the first decision of its kind, the Supreme Court affirmed the appeals court ruling.

Fedorenko then applied to return to the Soviet Union. His attorney, Andrew Filipovich, said yesterday that Fedorenko left a wife and two sons there after the war. Later, believing his wife dead, he married an American, who died in 1971.

Filipovich said Fedorenko had visited the Soviet Union three times before losing his U.S. citizenship, the AP reported.

"He's very upset about. . . going to the Soviet Union" and, if he returns, faces possible criminal prosecution, Filipovich told United Press International.

Fedorenko would be the sixth former Nazi-era war criminal to leave the country and the first who exhausted his appeals in the courts. The other five were either deported or renounced their citizenship and left the country when the special investigations office confronted them.

In the most prominent case, Arthur L.H. Rudolph, 78, a German-born scientist and engineer who designed the U.S. moon rocket, returned to West Germany last March rather than battle charges that he was responsible for persecution and death of slave laborers building Nazi rockets. Authorities did not disclose his case until October.

A few days later, authorities announced that John Avdzej, 79, a retired New Jersey draftsman accused of persecuting Jews as a mayor in occupied Byelorussia, had left for West Germany in February.

Last August, former Romanian Orthodox archbishop Valerian Trifa, 70, accused of atrocities in Romania, was sent to Portugal. A month earlier, Anatoly Hrusitsky, 66, accused of persecuting Jews as a Ukrainian policeman, renounced citizenship and went to Venezuela.

In April 1983, Hans Lipschis, a Lithuanian guard accused of persecution and murder, was deported to West Germany.