Term for when someone falsely accuses you of doing to them what they are actually doing to you

Solution 1:

One relevant term is "hypocrisy", "The practice of engaging in the same behaviour or activity for which one criticises another." (https://en.wiktionary.org/wiki/hypocrisy) It does miss, though, the point where you're innocent; someone can justly indict another for vice and still be a hypocrite.

Another related term is "gaslighting", from a 1938 play, which means "To manipulate someone psychologically such that they question their own sanity." (https://en.wiktionary.org/wiki/gaslight#English) That might be too specific, but trying to re-write fact that thoroughly often involves gaslighting.

The term "ad hominem", though, is a fallacy of logic, whereby you attack "an argument or factual claim by appealing to a characteristic or belief of the person making the argument or claim, rather than by addressing the substance of the argument or producing evidence against the claim." (https://en.wiktionary.org/wiki/ad_hominem)

Solution 2:

Isn't this a type of 'projection' in the psychological sense? http://changingminds.org/explanations/behaviors/coping/projection.htm

Projection

When a person has uncomfortable thoughts or feelings, they may project these onto other people, assigning the thoughts or feelings that they need to repress to a convenient alternative target.

[…]

  • Neurotic projection is perceiving others as operating in ways one unconsciously finds objectionable in yourself.

Solution 3:

This is a form of projection. Oftentimes people (generally the more unhealthy ones) will project their own shortcomings and missteps on others as a form of defense.

More accurately though the act of doing this is generally considered gaslighting. It is literally the adult equivalent of the "I know you are but what am I?"

It can become quite frustrating and demoralizing to the victim. Oftentimes people who are considered Narcissistic Personality, Sociopaths and Borderline Personality will employ this tactic.

Solution 4:

Check this idiom: The pot calling the kettle black

From Wikipedia: The phrase "The pot calling the kettle black" is an idiom used to claim that a person is guilty of the very thing of which they accuse another.