I would go out on a limb and say that the metaphor underlying dank here is of something old and relegated to a damp basement, edit: or something wet and smelly like vegetable matter in a wet place.
Dank weed is a 150-year-old collocation referring to such plant matter, and that's how it got applied to (top quality) marijuana, whose skunky smell and funky appearance resembled a weed from a moist place and beginning to decompose.
“Dank Memes” is an ironic expression used to mock online viral media
and in-jokes that have exhausted their comedic value to the point of
being trite or cliché. In this context, the word “dank,” originally
coined as a term for high quality marijuana, is satirically used as a
synonym for “cool.” http://knowyourmeme.com/memes/dank-memes
So, according to knowyourmeme.com, "dank" is a term of approbation (like "cool") but is being applied ironically to mean just the opposite, not cool
.