Rich Homie Quan wasn't lashing out at a fan when he smacked a guy at a concert earlier this month ... he was dishing out justice to a dude he says was TRYING TO ROB HIM.As we reported ... Quan was performing on stage in Racine, Wisconsin July 4 when…