Anomaly-free leptophilic axionlike particle and its flavor violating tests