The conjecture first fails at
p(102091222) = 2082927019,
where both counts are 51045610.
It was verified with two independent programs in C and PARI/GP.
It is known that pi(3,7)/pi(1,9) tends to 1.
I expect f(p(n)) to take any value infinitely many times.