Looking for the name of a fallacy

The fallacy is discounting evidence from someone because they have a reason to lie. Something like:
Police officer: A neighbor said you were blaspheming. I’m writing you a summons.
You: I wasn’t blaspheming.
Police office: They have no reason to lie** but you do to get out of court so I’m sure you were blaspheming.

**That he knows of.

Affirming the consequent?

Not every error a person makes is a logical fallacy. This case is not a matter of logic. Logic does not involve itself with credibility of evidence from a person, only the facts and the chain of reasoning. The ad hominem fallacy generally covers the attempt to discredit an argument not based on its merits but based on the person who is making the argument. Other fallacies are faulty reasoning, such as begging the question where you have to assume what you are trying to prove in order to prove it. Affirming the consequent is the fallacy where you use a statement to prove its converse, like if the TV is unplugged, it won’t turn on. But you can’t use that to argue that if the TV won’t turn on, it means it’s unplugged. (In logic class you would say that “if p then q” does not imply that “if q then p”. And then you would construct an axiomatic proof as to why it does not imply that.)

Saying that your statement is false because it would benefit you to lie about it is, I suppose, some flavor of ad hominem but it is not really a logical fallacy. In fact I would guess this argument is not a fallacy at all and is used all the time in criminal cases with defendants and with witnesses who make a deal.

BTW I know your example is just to illustrate the question, but where does this happen anyway? Saudi Arabia?

The fallacy is called MRDA

https://en.wikipedia.org/wiki/Wikipedia:Mandy_Rice-Davies_Applies

That sounds like an appropriate identification for this scenario, but MRDA is not a logical fallacy. It’s more of a rhetorical device.

Ad Hominem Circumstantial.

Description: Suggesting that the person who is making the argument is biased or predisposed to take a particular stance, and therefore, the argument is necessarily invalid.

Logical Form:

Person 1 is claiming Y.

Person 1 has a vested interest in Y being true.

Therefore, Y is false.

Example #1:

Salesman: This car gets better than average gas mileage and is one of the most reliable cars according to Consumer Reports.

Will: I doubt it—you obviously just want to sell me that car.

The vast majority of what people call logical fallacies aren’t, either. The usual term is “informal logical fallacies.”

That was it. I learned it as Appeal to Motive but couldn’t remember that name.

Maybe Argument from Ignorance:

Argument from ignorance (from Latin: argumentum ad ignorantiam ), also known as appeal to ignorance (in which ignorance represents “a lack of contrary evidence”), is a fallacy in informal logic. It asserts that a proposition is true because it has not yet been proven false or a proposition is false because it has not yet been proven true. This represents a type of false dichotomy in that it excludes the possibility that there may have been an insufficient investigation to prove that the proposition is either true or false.[1] It also does not allow for the possibility that the answer is unknowable, only knowable in the future, or neither completely true nor completely false.[2] In debates, appeals to ignorance are sometimes used in an attempt to shift the burden of proof. In research, low-power experiments are subject to false negatives (there would have been an observable effect if there had been a larger sample size or better experimental design) and false positives (there was an observable effect; however, this was a coincidence due purely to random chance, or the events correlate, but there is no cause-effect relationship). The term was likely coined by philosopher John Locke in the late 17th century.[3][4] ~SOURCE