I think they are mostly interchangeable, but not always. Since to me diversity connotes different types of things (like diverse plants in the habitat, diverse options to choose from), while variety is more like randomness (the weather varies, the direction of the wind varies, the food you eat varies). I wonder what other people think, though.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.