BERLIN (AP) _ President Clinton, standing before the Brandenburg Gate that once symbolized divided Europe, today urged people to overcome modern-day forces of division and racism. In well-rehearsed German, he said: ''Everything is possible. Berlin is free 3/8''

''We stand where Europe's heart was cut in half and we celebrate unity,'' said Clinton, the first U.S. president to visit reunited Berlin and the first to set foot in the eastern sector since Harry Truman in 1945.

Speaking to tens of thousands of Berliners in what was once communist- controlled East Berlin, Clinton declared: ''We must reject those who would divide us with scalding words about race, ethnicity or religion.''

The comments were aimed at not only ethnic strife in Bosnia and elsewhere, but at the recent resurgence of extremist groups such as neo-Nazis in Germany.

''I appeal especially to the young people of this nation. Believe you can live in peace with those who are different than you,'' Clinton said. ''Believe you can make a difference and summon your own courage to build and you will.''

Later, Clinton presided over a ceremony deactivating the U.S. Army's elite Berlin Brigade, which once confronted the Soviets and East Germans at Checkpoint Charlie and supervised the exchange of political prisoners.

The ceremony marked the end of a 49-year U.S. military presence in Berlin, although U.S. troops will remain in other parts of Germany.

The flag flying over McNair Barracks, the home of the brigade, was lowered, folded and given to Clinton to bring home.

''We are marking the end of a half century of sacrifice on freedom's frontier,'' Clinton said. ''America salutes you. Mission accomplished,'' he told the approximately 1,000 troops in a parade-ground speech.

Pariser Platz, the plaza beneath Brandenburg Gate, was packed with people for Clinton's earlier speech. Police estimated the crowd at 50,000 even though the White House claimed a size of 120,000 or more. Many were school children given the day off for Clinton's visit.

Clinton took a cue from his political hero, President John F. Kennedy, and delighted the crowd by uttering several phrases in German.

''Nichts wird uns aufhalten. Alles ist moeglich 3/8 Berlin ist frei,'' Clinton said, then repeating in English: ''Nothing will stop us. Everything is possible. Berlin is free.''

Clinton, who does not speak German but took courses as an undergraduate at Georgetown University, also said: ''Amerika steht an Ihre Seite, jetzt und fuer immer. America stands by your side now and forever.''

Kennedy's celebrated words ''Ich bin ein Berliner'' were uttered in a speech in Berlin on June 26, 1963 as a gesture identifying the United States with West Berlin - then an island of democracy surrounded by the Berlin Wall and communist East Germany.

''Half a century has past since Berlin was first divided,'' Clinton said in his 10-minute, impassioned speech. ''In that time, one half of this city lived encircled and the other half enslaved. But one force endured: your courage.''

The 200-year-old Brandenburg Gate stands in the eastern sector of the city. Before the wall sealed off the gate as well as the rest of East Berlin, it had been one of the crossing points between east and west.

The wall was built in 1961 and torn down in 1989. Germany was reunited in 1990.

''The Berlin Wall is gone,'' Clinton said. ''Now our generation must decide what will we build in its place.''

Many of his comments were greeted with cheers and applause. ''That he even came to this side of the Brandenburg Gate, I never would have believed that I would experience that,'' said Karin Pehla, a 39-year-old computer programmer. An East Berliner, she had tears in her eyes.

But Adeleid Pullmann, also 39, said ''It was short and sweet but nothing special.'' Her friend, Baerbel Gallus, 35, added: ''There were too many cliche words.''

Some expressed distaste for Clinton's reference to Cold War Berlin as ''one-half encircled and the other half enslaved,'' suggesting it made light of the lives of East Berliners. ''He lost a lot of East Berliners with those words,'' said Paul-Guido Osselmann, a German-American.

Clinton spoke near the site of what had been the pre-World War II American embassy. When Germany completes moving its seat of government from Bonn back to Berlin by the year 2,000, ''I pledge to you today a new American embassy will also stand in Berlin,'' Clinton said.

It was Clinton's final stop of an eight-day European trip.

German Chancellor Helmut Kohl, who spoke before Clinton, proclaimed: ''Long live the friendship between Germany and America.''

''We cannot and must not be satisfied with our achievements to date,'' Kohl said. ''The upheaval in Europe and our common future make demands of us all. Freedom imposes obligations.''

Clinton's visit coincided with a ruling today by Germany's highest court that German troops can be sent abroad on U.N. missions, reversing a postwar policy adopted to keep the country from ever again becoming a military threat.

''I am completely comfortable with that,'' Clinton said of the decision, which was also applauded by Kohl.

Earlier, Clinton met at the Reichstag - the restored German parliament building burned by the Nazis in 1933 - with Kohl, Speaker of Parliament Rita Sussmuth, and European Commission President Jacques Delors.

At a news conference following the meeting, Clinton announced the formation of two U.S.-European task forces - one to recommend ways to strengthen ties with the new democracies of eastern and central Europe and the other to coordinate the fight against organized crime, drug trafficking and money laundering.

Clinton ''These are problems that ''know no borders,'' Clinton said.

The president also visited a 128-year-old Jewish synagogue that was damaged by Nazi attacks in 1938 and then by allied bombs in 1943. The synagogue is being restored.

Clinton had some hard acts to follow in terms of presidential addresses in Berlin.

In addition to Kennedy's immortal 1963 speech, Ronald Reagan on June 12, 1987, stood before the Berlin Wall and declared: ''Mr. Gorbachev, open this gate. Mr. Gorbachev, tear down this wall.''

Reagan, too, broke into German at one point - showing that Kennedy's rhetorical flourish could be copied by a Republican president as well as a Democratic one.