My problem was similar, I've tried to delete Gmail mailboxes in Mail app and I got the same error "The operation couldn’t be completed. Unable to find an account for the UID given"... Following the first advices on this chat, trying to delete com.apple.mail was a mess, all my stuff gone, personal mailboxes (On My Mac), etc... so that's not a solution to me.
I've just performed some accurate, just follow this:
1- Edit Account.plist file located in /Users/YOURUSERNAME/Library/Mail/V2/MailData/Accounts.plist with Xcode or a Plist editor (MAKE A COPY OF ORIGINAL Accounts.plist FIRST !!!, ex: copy it and rename it as Accounts_old.plist).
2- Look for each account you got with error (look for "MailAccounts" line, extend it, look for one by one each item (item 0, item 1, item 2, etc...) and locate "Account name" line in order to find the mailbox you want to delete, find it and delete the proper Item (ex: Item 3, Item 6, Item 8, and so on...). TAKE CARE ABOUT HAVING ACCOUNTS WITH SIMILAR NAMES OR EQUAL NAMES -same account name but different hosting, etc- DELETE THE PROPER ONE... just a tip: look inside each item content at the line that shows you the hosting provider like GMAIL, "YOUR DOMAIN", etc). Note that each time you delete an item the order of items is still the same (it's just a reorder of the content, the item you delete is really deleted... you know what I mean).
It worked for me.
P.S: it's an Alex Neil comment extended explanation 😉
I hope to help with this. Regards!