describes
pursuing a mistaken line of inquiry, blaming the wrong person or looking for a solution in the wrong place.
For example, to pursue the wrong person, idea, or course of action; to make a false accusation or look for a solution in the wrong place. This is a situation where “Barking up the wrong tree” applies.