The stress (accent) is on the second syllable (dez-URT). Click dessert for pronunciation.
Desert can be a noun or a verb. As a noun, it is a dry, barren area of land where there is little rainfall. As a result, there is a lack of water and vegetation. The stress is on the first syllable (DEZ-urt). Click desert for pronunciation.
As a verb, desert means to abandon. The stress is on the second syllable, sounding similar to the sweet food, dessert.
A good way to remember the difference in spelling if you are having difficulty is to remember that a dessert is usually super sweet. Super Sweet Desserts (double the 's').
Fun Fact: Did you know that "desserts" spelled backwards is "stressed"?
This is called a semordnilap, which is a term coined in recent years to refer to words and phrases that also make sense when read backwards, but have a different meaning from when they are read forwards -- itself a semordniliap of "palindromes".