I use K9-Mail v8.2 on a Pixel 7a with Android 15 (GrapheneOS).
When I recently had a certificate error, I unfortunately had to act quickly. That’s why I permanently accepted an invalid certificate in K9 Mail.
Gear icon > IMAP mailbox > Retrieve emails > Incoming mail server > Settings Incoming mail server to accept > Next > Advanced > Accept risk and continue
Not sure about Graphene, but regular Android:
Settings → Security and Privacy → More Security and Privacy → Encryption and Credentials → Trusted Credentials → User
If it’s not there go back two steps to “User Credentials”.
You should be able to tap the certificate and either disable or delete it.