Good point, motive and intent do have value in assessing the likelihood that someone committed an crime (or any action). It's not quite the same as using motive to claim that someone is wrong though.
However, I agree that ad hominem is not always fallacious. If I claim that tobacco is not bad for health and it turns out that I have no medical background and that I was paid by the tobacco industry, arguably an ad hominem argument can be used to cast some doubts on my credibility on this particular issue. Probably enough doubts that one doesn't need to pay further attention to what I said.
However it's an approach that should be used with caution. It is much too easy to misuse it to lazily explain away someone's inconvenient argument. It is particularly pernicious when it is using a supposed feeling like jealousy, that are hard to disprove.
https://en.wikipedia.org/wiki/Motive_(law)