Allan Metcalf has a Lingua Franca column laying out the history of the word dude, as discovered by Barry Popik and Gerald Cohen and presented in the latest issue of Comments on Etymology:
Thanks to Popik and Cohen’s thorough investigation, it seems almost certain that “dude” derived from “doodle,” as in “Yankee Doodle Dandy.” The original New England Yankee Doodle, Cohen notes, “was the country bumpkin who stuck a feather in his cap and called it macaroni; i.e., by sticking a feather in his cap, he imagined himself to be fashionable like the young men of his day known as ‘macaronis.’”
For some reason, early in 1883, this inspired someone to call foppish young men of New York City “doods,” with the alternate spelling “dudes” soon becoming the norm. Exactly what these fashionable fools were like unfolds copiously in the pages of Comments. Here there is room for just a small sample. […]
(He also mentions “dudine,” for which see this LH post.) By all means read the examples, and be grateful for the devoted burrowers in 19th-century newspapers who give us things like this!