He'd have to successfully challenge Mississippi's "sore loser" law that prohibit such write-in campaigns.
I believe the law says that having lost in the primary, McDaniel can't be on the ballot as an independent or representative of any party. But does that prevent people from writing in his name? And if enough people did that then could they really prevent him from taking the seat? A colossal long-shot to be sure, but it worked for Murkowski.