See Chapter 15 ("Oscillation of error terms") in Montgomery-Vaughan: Multiplicative number theory I. See especially Theorems 15.2-15.3 and 15.11.
Added by Steven Clark and GH from MO. For convenience, we copied below the relevant theorems and some additional text from the book. As usual,
$$M(x):=\sum\limits_{n\le x}\mu(n)$$
is the Mertens function.
Theorem 15.2. Let $\Theta$ denote the supremum of the real parts of the zeros of the zeta function. Then for every $\varepsilon>0$,
$$\psi(x)-x=\Omega_\pm(x^{\Theta-\varepsilon})\tag{15.1}$$
and
$$\pi(x)-\mathrm{li}(x)=\Omega_\pm(x^{\Theta-\varepsilon})\tag{15.2}$$
as $x\to\infty$.
Theorem 15.3. Suppose that $\Theta$ is the supremum of the real parts of $\zeta(s)$, and there is a zero $\rho$ with $\Re\rho=\Theta$, say $\rho=\Theta+i\gamma$. Then
$$\underset{x\to\infty}{\text{lim sup}}\ \frac{\psi(x)-x}{x^{\Theta}}\geq \frac{1}{| \rho |}\tag{15.4}$$
and
$$\underset{x\to\infty}{\text{lim inf}}\ \frac{\psi(x)-x}{x^{\Theta}}\leq -\frac{1}{| \rho |}.\tag{15.5}$$
Theorem 15.11. As $x\to\infty$,
$$\psi(x) -x = \Omega_{\pm} \bigl(x^{1/2} \log \log \log x\bigr),$$
and
$$\pi(x) - \mathrm{li}(x) = \Omega_{\pm} \bigl(x^{1/2}(\log x)^{-1}\log \log \log x\bigr).$$
Then in the manner of the proof of Theorem 15.3, we find that if $\Theta+i\gamma$ is a zero of $\zeta(s)$, then
$$\underset{x\to\infty}{\text{lim sup}}\ \frac{M(x)}{x^{\Theta}}\geq \frac{1}{| \rho\,\zeta'(\rho) |},\tag{15.11}$$
and
$$\underset{x\to\infty}{\text{lim inf}}\ \frac{M(x)}{x^{\Theta}}\leq -\frac{1}{| \rho\,\zeta'(\rho) |}.\tag{15.12}$$
As $T\to\infty$, we have
$$
N(T) = \frac{T}{2\pi}\log\frac{T}{2\pi}-\frac{T}{2\pi}+\frac{7}{8}+\frac{1}{\pi}\int_{\frac{1}{2}}^{\infty}\mathrm{Im}\Big(-\frac{\zeta'}{\zeta}(\sigma+iT)\Big)d\sigma+O(T^{-1}).
$$
This is proved in Chapter 15 of Davenport's Multiplicative Number Theory. The error term $O(T^{-1})$ is a truncation for the asymptotic expansions for the arctan and gamma functions. The contribution from the arctan function consists of lower order terms in a Taylor expansion, and the contribution from the gamma function consists of lower order terms in the Stirling expansion.
EDIT: Because of the apparent lack of clarity regarding "arg" in this result, I replaced "$\arg \zeta(1/2+iT)$" with the corresponding integral, which should not be ambiguous. I hope this helps.
Best Answer
Without any restriction on $x$ and $T$ (aside from $x,T \ge 2$) one has $$f(x,T) \ll \frac{x}{T}\log^2 x + \log x,$$ which goes back to Landau. A modern reference is Theorem 12.5 in Montgomery and Vaughan's book (p. 400). By using the Brun-Titchmarsh inequality when bounding the error incurred from Perron one can do better. This is done by Goldston in "On a result of Littlewood concerning prime numbers. II" (Acta Arith. 43, 49-51 (1983)) where the main Theorem states $$\begin{equation} \label{eq:G}\tag{*} f(x,T) \ll \frac{x}{T}\log x\log \log x + \log x \end{equation}$$ unconditionally. Another reference is Exercise 2 in p. 408 of the aforementioned book. In your range this means $(\log T)^2$ in your bound can be replaced by $\log T\log \log T$.
Remarks:
Estimates $\eqref{eq:CHJ}$ and $\eqref{eq:RH}$ are proved with explicit constants. Estimate $\eqref{eq:G}$ can be made explicit too -- see GH from MO's answer.
One should say that $\eqref{eq:CHJ}$ and $\eqref{eq:RH}$ supersede a conditional result of Littlewood, who proved on RH that $f(x,T) \ll\tfrac{x}{T}\log x+ \sqrt{x}\log x$. In fact, $\eqref{eq:CHJ}$ shows Littlewood's result holds unconditionally.