In this article, the distributed push‐pull gradient optimization algorithm over directed communication network under false data injection (FDI) attacks is investigated. First, the convergence of the algorithm under FDI attacks is analyzed, and the conditions are presented to ensure convergence. Second, on the basis, a distributed reputation‐based neighborhood‐observe strategy is proposed, which can detect the malicious agents residing in the network and isolate them. Moreover, different from the existing resilient strategies, the influence of the false data on the algorithm is eliminated completely to ensure that the remaining normal agents can converge to the optimal solution. Finally, some examples are presented to validate the effectiveness of the proposed strategy.