BONN, JUNE 14 -- Nobel peace laureate Willy Brandt appealed for detente and social justice today in a farewell address to his fellow Social Democrats as he formally stepped down as chairman of the party that he led for 23 years.

A special party congress elected moderate Hans-Jochen Vogel to replace Brandt and gave the new chairman a solid endorsement with 404 out of a possible 423 votes. The delegates chose leftist Oskar Lafontaine as one of two deputy chairmen by a smaller margin.

Vogel said the left-of-center Social Democrats were "the party of hope" but acknowledged that he had no ready-made "formula for new victories."

The Social Democrats have lost the last two national elections, in January and in 1983. Vogel lost to Christian Democrat Helmut Kohl in the race for chancellor four years ago.

The party chairmanship is a more influential position in West Germany than in the United States. The chairman here shapes the party's platform on national issues and oversees selection of candidates for parliament.

Brandt, 73, had hoped to serve as chairman until next summer. But on March 23 he was forced to announce his intention to resign after the party rebelled against his nomination of a young Greek family friend to be party spokeswoman.

The controversy brought to a climax simmering unhappiness within the party over what was viewed as Brandt's domineering style of leadership and his reluctance to make way for a new generation.

Brandt defended his choice of Margarita Mathiopoulos for the spokeswoman's job, but he conceded that he was sorry about the controversy. Mathiopoulos, who is neither a West German citizen nor a Social Democrat, withdrew from consideration for the post when Brandt's ouster was decided.

"Let me say in all openness that I would have preferred a different departure," Brandt said.

"I've made my mistakes. I've not always considered everything that needed to be considered. I'm sorry. And that's it," he said, as the audience laughed and applauded.

Most of Brandt's speech was a forward-looking call to the party to press for reform to benefit the disadvantaged at home and abroad.

"We need the support of the so-called outsiders. We also need the troublemakers, the dissidents," he said.

Brandt, who as chancellor won the Nobel Peace Prize in 1971 for his Ostpolitik of building better relations with the Soviet Bloc, said a proposed U.S.-Soviet accord to reduce medium-range missile arsenals was not an adequate substitute for political efforts to guarantee peace.

He also criticized the conservative view that East-West detente should proceed only if communist countries improve their human rights policies.

"Whoever takes human rights seriously, whoever wants to do more than make propaganda from it, cannot oppose detente," Brandt said.

The delegates gave Brandt an eight-minute standing ovation and unanimously elected him to the newly created post of honorary chairman. He was cited for his "great service to the Social Democratic Party, to the German people and to peace in Europe and the world."

Vogel, 61, who is affectionately called "the schoolmaster" because of his hard work and exhortations for party discipline, inherits the leadership at a difficult time. The Social Democrats have lost many young voters in recent years to the more militant Greens.

But Vogel benefited from Brandt's early departure because it made it easier for him to stave off an expected challenge for the party leadership from Lafontaine, 43, the charismatic premier of the southwestern state of Saarland.

Party leaders had predicted earlier this year that Lafontaine would succeed Brandt, but the leadership endorsed Vogel in the interest of maintaining party unity in the wake of Brandt's embarrassing resignation.

Lafontaine accepted the deputy chairmanship as a consolation prize. There already is speculation that he, rather than Vogel, will be the party's candidate for chancellor in the next election.

Lafontaine joined Johannes Rau, who was the losing candidate for chancellor in January, as deputy chairman. Lafontaine received 353 out of a possible 423 votes, with 62 delegates opposing him and the rest abstaining.