possible bug: when using External ID as matching method, imported contributions can get matched to contacts in the trash--would expect error instead
I suggest you create an issue at https://lab.civicrm.org/dev/core/-/issues
I'd think it should be treated in the same way as if you matched on a contact id that was soft-deleted.
The message you quote appears to be generated from CRM_Contribute_Import_Parser_Contribution::deprecatedFormatParams() but given the name, a quick fix to that function to handle external id is not the answer.