Okay - given that you're in Canada, the 'M' indicates the Lago Alberto assembly plant.
Hmmm... 'D' was the engine code for the diesel in '98 and up. Maybe yours was a late-year build in '97, and they had already started using the 'D' designation.
Regardless - yeah, your dealership just gave you the wrong info. Shocking, isn't it? :)
Here's a link to give you all the specs. on your engine: