So the Flagged email mailboxes in the Favorites section of the sidebar don't show the email, right?
If you create a smart mailbox with the following criteria are you able to see all of your flagged email?
If it's no to both questions try the following:
1 - select all mailboxes in the sidebar and use the Mailbox ➙ Rebuild menu option. Let it run for about 5 minutes.
2 - boot into Safe Mode according to Start up your Mac in safe mode - Apple Support and see if the problem persists. Reboot normally and check again.
NOTE: Safe Mode boot can take up to 10 minutes as it's doing the following;
• Verifies your startup disk and attempts to repair directory issues, if needed
• Loads only required kernel extensions (prevents 3rd party kernel/extensions from loading)
• Prevents Startup Items and Login Items from opening automatically
• Disables user-installed fonts
• Deletes font caches, kernel cache, and other system cache files