This fact is stated in Weibel's book without proof:
If $A$ is a finitely generated module over a commutative Noetherian local ring $(R,\mathfrak{m},k)$, then $id(A) \le d$ is equivalent to $\operatorname{Ext}^{n}_{R}(k,A)=0$ for all $n > d$.
I can prove one direction since $id(A) \le d$ is equivalent to $\operatorname{Ext}^{n}_{R}(R/\mathfrak{a},A)=0$ for all $n > d$ for all ideals $\mathfrak{a} \subset R$. Could you help me with the other direction?