Sammy Davis Jr., a versatile and dynamic singer, dancer and actor who overcame extraordinary obstacles to become a leading American entertainer, died of throat cancer yesterday at his home in Los Angeles. He was 64 years old and had been in deteriorating health since his release from Cedar-Sinai Medical Center on March 13. The showman was born in a Harlem tenement, grew up in vaudeville from the age of 3 and never went to school. His talents as a mime, comedian, trumpet player, drummer, pianist and vibraphonist as well as singer and dancer were shaped from his childhood and made him one of the nation's first black performers to gain mainstream acclaim. With heavy jewelry around his neck and on his fingers, and clad in a snug jumpsuit or tuxedo, the short, slim showman with a broken nose, defiant jaw and big, crooked smile had a rakish charm that energized stages for decades. He sold out leading nightclubs and concert halls, won personal triumphs in such Broadway musicals as ''Mr. Wonderful'' (1956) and ''Golden Boy'' (1964), illumined movies and television and made scores of hit recordings with such signature songs as ''What Kind of Fool Am I?,'' ''Candy Man,'' ''Mr. Bojangles'' and ''I've Gotta Be Me.'' The triumphs were punctuated by sometimes ugly controversies - abuse and slurs by whites, particularly over his marriage to a white actress, May Britt; resentment by blacks over what they viewed as his white life style, and widespread skepticism over his mid-1950's conversion to Judaism. Mr. Davis also endured major health setbacks. He lost his left eye in a near-fatal 1954 auto crash, had reconstructive hip surgery in 1985 that enabled him to dance again, and was told last year that he had throat cancer. He underwent eight weeks of radiation treatments for a carcinoma growing behind his vocal cords, until his doctors said the cancer was in remission. He had smoked heavily for many years. The debilitating illness and treatment prompted 26 of his fellow entertainers to salute his courage and longtime efforts to lower racial barriers in a two-and-a-half-hour television tribute on Feb. 4. The frail but indomitable Mr. Davis, whose voice was only a husky whisper, did not speak, but he rose to do a brief soft-shoe step to a standing ovation. Only a year earlier, he had announced his defeat of alcohol and cocaine. He completed a world tour with Frank Sinatra and Liza Minnelli (who filled in for an ailing Dean Martin) and publicized ''Why Me?,'' a book on which he had collaborated with his friends Jane and Burt Boyar as a sequel to their best-selling 1965 Davis biography, ''Yes I Can.'' The 1989 book said that John F. Kennedy had asked Mr. Davis and Miss Britt not to participate in the 1961 Presidential inauguration, lest the sight of an interracial couple anger Southerners. Mr. Davis also recounted the racism that haunted his life, from bloody fights in the Army to being turned away from New York nightclubs. His conversion to Judaism, according to the book, arose from self-scrutiny during his convalescence from the 1954 car crash. His family was Baptist and until then he had thought little of religion, but he studied Judaism deeply, concluded ''it teaches justice for everyone,'' and found ''an affinity'' between Jews and blacks, who have both ''been oppressed for centuries.'' The second biography also explored the breakup of his marriage to Miss Britt, who, in divorcing him in 1968, cited ''no family life to speak of,'' and his neglect of their three children: a daughter, Tracey, and two adopted sons, Mark and Jeff. He had previously been married briefly to Loray White, a dancer. In 1970 he married Altovise Gore, also a dancer. Mr. Davis admitted to compulsive carousing, reckless gambling and spending ($50 million over 20 years while earning $3 million a year) and excessive drinking and smoking. With characteristic bravado, he once again hailed himself as a reformed man, boasting of sobriety with such ironies as ''The hardest thing is waking up in the morning and realizing that's as good as you're going to feel all day.'' Yet there was a more private side to Mr. Davis. The entertainer eschewed publicity while taking part in civil rights marches and contributing generously to humanitarian causes. His many awards included induction into the Hall of Fame of the National Association for the Advancement of Colored People, honorary degrees from black colleges, and a Kennedy Center honor for career achievement. A deep regret of the aging Mr. Davis was his support of Richard M. Nixon during the 1972 Presidential election campaign. He later renounced his backing, accusing Mr. Nixon of having made civil rights promises he did not keep. Looking back in 1987, Mr. Davis affirmed that if the Kennedy Center salute to his career did not soften his rancor over the inaugural racial rebuff by President Kennedy, ''I don't know what does.'' Sammy Davis Jr. was born to Sammy Davis and the former Elvira Sanchez on Dec. 8, 1925, in a Harlem tenement at 140th Street and Eighth Avenue. He was brought up by his father's mother, Rosa Davis, while his parents, both vaudevillians, were on tour. In his third year, his mother left the act and also the family, and he joined the Orpheum circuit with his father and Will Mastin. With typical zest, the youngster learned show business while his father got him occasional tutors to appease truant officers. As sound movies began to cripple vaudeville, the troupe shrank and eventually became ''The Will Mastin Trio, featuring Sammy Davis Jr.'' Drafted at 18, he graduated from comic books after remedial reading lessons from a black sergeant while he battled racist taunts and insults from white G.I.'s, who repaid him several times by breaking his nose. Performing in Army camps around the country, he worked hard, he recalled, to reach the bigots, ''neutralize them and make them acknowledge'' him. After the war, with vaudeville nearly dead, the Will Mastin Trio had several lean years struggling to break into variety theaters and cabarets around the country. Gradually, as Mr. Davis honed his talents, the act became his showcase, with his father and uncle providing tap and soft-shoe background. The group, now ''starring Sammy Davis Jr.,'' began playing top variety houses and nightclubs, becoming headliners and repeatedly breaking box-office records, while he gained solo prominence with recordings and television appearances as a variety showman and actor. On Broadway, Mr. Davis had many concert successes and starred in three musicals. One, in 1956, was the quasi-biographical ''Mr. Wonderful,'' which drew from Brooks Atkinson, drama critic of The New York Times, the observation that the show ''comes alive only when young Mr. Davis rocks and rolls, tap-dances or does imitations.'' The other two musicals were an updated version of ''Golden Boy'' in 1964 and a 1978 revival of ''Stop the World, I Want to Get Off.'' Perhaps his most enduring movie role was Sportin' Life in ''Porgy and Bess'' (1959), a part that elicited high praise from Bosley Crowther, motion picture critic of The Times. Mr. Crowther wrote that ''in every respect he is the sharpest and most insinuating figure in the show.'' He played an avuncular dancer in ''Tap'' (1989), his last movie role. His other films include ''Ocean's 11'' (1960), ''Sergeants Three'' (1962), ''Johnny Cool'' (1963) and ''Robin and the Seven Hoods'' (1964). In addition to his wife, Altavesa, his mother, his daughter, Tracey, and sons Mark and Jeff, Mr. Davis is survived by his son Manny; two sisters, Ramona James of Manhattan and Suzette Davis of Portland, Ore., and two grandchildren, Andrew and Sam Michael. A funeral will be held tomorrow at 11 A.M. at Forest Lawn Memorial-Park in the Hollywood Hills, with burial at Forest Lawn Memorial-Park in Glendale.