So here is an answer, edited first from an unproved guess at the correct $f(a,b)$ and then a terse proof. The following version has a few more details added.
I claim that
$$
f(a,b)=\int_0^{b+1} \left(\left\lfloor \frac{a+1}x\right\rfloor
-\left\lfloor\frac ax\right\rfloor
-\left\lfloor\frac{b+1}x\right\rfloor
+\left\lfloor\frac bx\right\rfloor\right)^+\,dx.
$$
This is derived from the exact expression:
$$
\log p_n=\sum_p\left(\sum_{k=1}^\infty \left(\left\lfloor \frac{a_n+n-1}{p^k}\right\rfloor
-\left\lfloor \frac{a_n-1}{p^k}\right\rfloor-
\left\lfloor \frac{b_n+n-1}{p^k}\right\rfloor
+\left\lfloor \frac{b_n-1}{p^k}\right\rfloor\right)\log p
\right)^+
$$
Firstly from the exact expression, I claim that the contribution of those primes less than $n^{2/3}$ is at most $n^{2/3}\log n$, so that it suffices to consider only those primes in the range $[n^{2/3},(b+2)n]$. To see this, first notice that for each $p$ and $k$, the expression in the inner parentheses takes only values 0 and $\pm 1$. Also each $p$ only makes a contribution for powers up to $\log n/\log p$, so the maximum contribution from any $p$ is $O((\log n/\log p)\times \log p)=O(\log n)$. Hence the upper bound for the combined contribution for $p<n^{2/3}$. For larger primes, clearly only the first power matters.
Let
$$
S_n=\sum_{p<(b+2)n}\left(\left(\left\lfloor \frac{a_n+n-1}{p}\right\rfloor
-\left\lfloor \frac{a_n-1}{p}\right\rfloor-
\left\lfloor \frac{b_n+n-1}{p}\right\rfloor
+\left\lfloor \frac{b_n-1}{p}\right\rfloor\right)\log p
\right)^+,
$$
so that by the above, $\log p_n=S_n+o(n)$.
Now for $\epsilon>0$, define three functions:
\begin{align*}
\bar g(x)&=
\min\left(\max\left(\left\lfloor \frac{a+1+\epsilon}x\right\rfloor
-\left\lfloor\frac{a-\epsilon}x\right\rfloor
-\left\lfloor\frac{b+1-\epsilon}x\right\rfloor
+\left\lfloor\frac{b+\epsilon}x\right\rfloor,0\right),1\right)\\
g(x)&=
\min\left(\max\left(\left\lfloor \frac{a+1}x\right\rfloor
-\left\lfloor\frac{a}x\right\rfloor
-\left\lfloor\frac{b+1}x\right\rfloor
+\left\lfloor\frac{b}x\right\rfloor,0\right),1\right)\\
\underline g(x)&=
\min\left(\max\left(\left\lfloor \frac{a+1-\epsilon}x\right\rfloor
-\left\lfloor\frac{a+\epsilon}x\right\rfloor
-\left\lfloor\frac{b+1+\epsilon}x\right\rfloor
+\left\lfloor\frac{b-\epsilon}x\right\rfloor,0\right),1\right)\\
\end{align*}
For all large $n$, we have $(a-\epsilon)n<a_n<(a+\epsilon)n$ and $(b-\epsilon)<b_n<(b+\epsilon)n$. For any such $n$, the $p$ summand in $S_n$ is between $\underline g(p/n)$ and $\bar g(p/n)$.
I next claim that $\int_0^{b+2} (\bar g-\underline g)=O(\epsilon\log(1/\epsilon))$. To see this, notice that if $x>2\epsilon$, $\lfloor \frac{c+\epsilon}x\rfloor$ and $\lfloor \frac{c-\epsilon}x\rfloor$ differ by at most 1, and they differ if $x\in \big((c-\epsilon)/n,(c+\epsilon)/n\big]$
for some $n$. The measure of the set where they differ is therefore $O(\epsilon\log(1/\epsilon))$, which proves the claim.
Now let $\underline h$ and $\bar h$ be continuous functions such that $\underline h\le \underline g\le \bar g\le\bar h$ and $\int_0^{b+2}(\bar h-\underline h)
\le 2\int_0^{b+2}(\bar g-\underline g)$.
For large $n$, we now have
$$
\sum_{p<(b+2)n}\underline h(p/n)\log p \le S_n
\le \sum_{p<(b+2)n}\bar h(p/n)\log p.
$$
An equivalent formulation of the prime number theorem is that
$\frac 1n\sum_{p<(b+2)n}\log p\,\delta_{p/n}$ converges in the weak topology to
Lebesgue measure restricted to $[0,b+2]$. (This is a consequence of the fact that $\sum_{p<n}\log p=n+o(n)$).
Hence $S_n-n\int_0^{b+2}g=o(n)$, as required.