In Mertens' original result, he proves that $$\sum_{p\leq x}\frac{1}{p}= \log\log x+B+O\Big(\frac{1}{\log x}\Big),$$ where $$B = \sum_p\Big(\log\Big(1-\frac{1}{p}\Big)-\frac{1}{p}\Big) = - \sum_p\sum_{k=2}^{\infty}\frac{1}{k p^k}.$$ Note that the summands in the sum up to $x$ and the summands in the sum defining $B$ are the Dirichlet coefficients of $\log \zeta(s+1)$, which are $\Lambda(n)/(n\log n)$ for $n\geq 2$. Here, $\Lambda(n)$ is the von Mangoldt function. It seems reasonable to suspect that if $f$ is self-dual (as the wording of the problem suggests, but does not explicitly state), then $$\sum_{p\leq x}\frac{a_f(p)^2}{p}=\log\log x+ B_f+O_f\Big(\frac{1}{\log x}\Big),$$ where $$B_f = - \sum_{\text{$n$ composite}}\frac{\Lambda_{f\times f}(n)}{n\log n}-\sum_{p\mid N}\frac{a_f(p)^2}{p}+\sum_{p\mid N}\frac{a_{f\times f}(p)}{p},$$ where $$\sum_{n=1}^{\infty}\frac{\Lambda_{f\times f}(n)}{n^s} = -\frac{L'}{L}(s,f\times f)$$ (the logarithmic derivative of the Rankin-Selberg $L$-function $L(s,f\times f)$). Note that if $p$ is a prime not dividing the level, then $\Lambda_{f\times f}(p) = a_f(p)^2\log p$. The coefficients $a_f(p)^2$ and $a_{f\times f}(p)$ might be different at primes $p$ dividing $N$. Since such $f$ satisfy Ramanujan's conjecture, we have $|\Lambda_{f\times f}(n)|\leq 4\Lambda(n)$. So $B$ can be bounded independently of $N$ or $k$. I have not supplied a proof, but the proof is at least as complicated as the case of $\zeta(s)$, which is detailed [here][1]. The proof will generalize. ADDED: In analogy with the case of primes, the Dirichlet coefficients of $\log L(s+1,f\times f)$ are $\Lambda_{f\times f}(n)/(n\log n)$. [1]: https://arxiv.org/abs/math/0504289v3