Answer is yes if $A$ is Noetherian and $P$ is finitely generated. Indeed, your condition implies that $Ext^1(P, N)=0$ for any finitely generated $A$-module $N$, which implies that $P$ is projective.