This is part of sensory processing. Suggestions:
Social Stories about appropriate sniffing.
Offer replacement objects that the student can sniff, stickers, squishies etc