You just need to use Imap.DeleteMessageByUID() method when INBOX folder is selected.
imap.SelectInbox();
List<long> uids = imap.Search(Expression.Subject("to archive"));
imap.DeleteMessageByUID(uids);
After this, emails are still available through "All Mail" IMAP folder.
https://www.limilabs.com/blog/archive-email-in-gmail
Note that if you use DeleteMessageByUID when other folder/label is selected, Gmail will not archive the message, but rather remove currently selected label.