1807, American English, "sauce, gravy; any thick liquid," from Dutch doop "thick dipping sauce," from doopen "to dip" (see dip (v.)). Used generally by late 19c. for any mixture or preparation of unknown ingredients.
Extension to "narcotic drug" is by 1889, from practice of smoking semi-liquid opium preparation. Meaning "foolish, stupid person" is older than this (1851) and may be from the notion of "thick-headed," later associated with the idea of "stupefied by narcotics."
Sense of "inside information" (1901) may come from knowing before the race which horse had been drugged to influence performance (to dope (v.) in this sense is attested by 1900). Dope-fiend is attested from 1896, "a victim of the opium habit."