There are different versions of IMAP in use, for instance MS-Exchange implements IMAP differently from the way GMAIL implements it. But the following will work to preserve a message on your desktop when it is deleted form other platforms:
Under the Mail Message menu, use the Copy To options to move a copy of the message to a folder that is On My Mac. On My Mac is local only storage for email messages. Once it has been copied (saved) to an On My Mac location, when you delete it on another device (iPhone, e.g.) and it is then deleted from all devices -- that is basically how IMAP works -- you will have a preserved copy on your desktop in that On My Mac folder.
Note that you have to copy the message this way BEFORE deleting it. Once deleted, it gets deleted from all the platforms using that email account, and from the email server, so it must be copied to local storage first.
POP physically downloads the email to each platform independently, but you then need to make sure that you don't have the message deleted from the server before the other devices have a chance to download (if you want the email on multiple devices). Usually the default is to delete the email from the server as soon as it is downloaded, but you can insert a time delay (say, 30 days) so that you have plenty of time to download it to other platforms as well. One drawback of POP is that the messages you want to delete must be deleted separately from each of multiple platforms if it has been downloaded to multiple platforms.