I believe the dealers response regarding 'replacing the battery' was due to them misunderstanding as "key not turning the engine over." That is partly their fault for not asking enough of the right questions to fully comprehend your issue.
Now, WD40 is not a long-term remedy for your ignition switch. Force some di-electric grease (or petroleum jelly) into the switch and insert the key. Do this a few times to lubricate the tumblers.
If your tractor is stored outside make sure rain cannot fall on the switch as it will dribble down the key and into the switch causing a recurrence of the problem.
Depending on your location and dealer proximity it would be worth buying a new switch assembly and having it on the shelf in case the problem returns. You now know you have a suspect switch which will need replacement sometime. Buy 2 x new keys at the same time. (Worn keys can ruin a new switch.)
:wrench: