I can’t vouch for the accuracy of the following site but it list 7 states that
prohibit write-in votes for President, etc.
http://www.anamericanvision.com/info/state_certifications.php
The website is correct but not complete in the underlying detail.
First, MS does allow for write-ins but only on a restricted basis. On the ballot there is a block for a write-in but it does not need to be counted if the name on it comes under the restrictions set forth by the state law.
Second, federal courts including the US Supreme Court have ruled that banning write-ins for President are legal “as long as all the other laws of the election process are constitutional”. Now there is also always an implicit provision for violation of law. In other words if the law has been subverted, will a candidate with “unclean hands” be allowed to advance because their opponent is excluded by any means of restriction according to state law. The federal courts say of course not. They will issue a federal injunction against a state very quickly as long as solid evidence and support is presented to support overruling the state restrictions.
In other words, the state election laws don’t matter much to the federal courts save for proper decorum. They will evaluate on a case by case basis what is appropriate for a particular federal office election. State office elections are usually not reviewed by federal courts unless there is clear violation of federal law for example discrimination, vote buying or election tampering.