Define the function $f \colon \mathbb{R}^3 \times S^2 \times \mathbb{R}^+ \to \mathbb{R}$ by
$$ f(\vec{r},\hat{u}, R) = \int \limits_{B_R(0)} \frac{\hat{u} \cdot \vec{r}'}{\left|\vec{r} - \vec{r}'\right|} \, \mathrm{d}^3 \vec{r}' .$$
The desired integral is $f(\vec{r},\hat{e}_2,R)$. Clearly, $f(0,\hat{u}, R) = 0$ holds by symmetry, so we can assume $\vec{r} = r \, \hat{r}$ with $\hat{r} \in S^2$ and $r > 0$ from now on. We will work with arbitrary $\hat{u} \in S^2$ and $R>0$.
We would like to introduce polar coordinates $(r',\theta',\phi')$ with $\hat{r}$ as the third axis for our integration variable $\vec{r}'$ to simplify the denominator (as shown in the question). However, since we have $\hat{r} \neq \hat{e}_3$ in general, we cannot simply plug the usual polar coordinates into the numerator ($y' = r' \sin(\theta') \sin(\phi')$ does not hold!). Instead, we decompose the unit vector $\hat{u}$ into two parts that are parallel and perpendicular to $\hat{r}$, respectively:
$$ \hat{u} = (\hat{u} \cdot \hat{r}) \hat{r} + \hat{r} \times (\hat{u} \times \hat{r}) \, .$$
This yields
$$ f(\vec{r},\hat{u}, R) = (\hat{u} \cdot \hat{r}) \int \limits_{B_R(0)} \frac{\hat{r} \cdot \vec{r}'}{\left|\vec{r} - \vec{r}'\right|} \, \mathrm{d}^3 \vec{r}' + (\hat{u} \times \hat{r}) \cdot \int \limits_{B_R(0)} \frac{\vec{r}' \times \hat{r}}{\left|\vec{r} - \vec{r}'\right|} \, \mathrm{d}^3 \vec{r}'.$$
The denominators can be written as $\left|\vec{r} - \vec{r}'\right| = \sqrt{r^2 + r'^2 - 2 r r' \cos(\theta')}$ and the first numerator is $\hat{r} \cdot \vec{r}' = r' \cos(\theta')$ in polar coordinates. The second numerator is a vector containing only those components of $\vec{r}'$ that are perpendicular to $\hat{r}$. Therefore, its components are proportional to $\cos(\phi')$ and $\sin(\phi')$ in polar coordinates and vanish upon integration from $\phi' = 0$ to $\phi' = 2 \pi$.
It should be noted that this argument can be replaced by a change of variables using a rotation matrix which maps $\hat{e}_3$ to $\hat{r}$ (its construction is discussed here).
Either way, we are left with the first integral:
\begin{align}
f(\vec{r},\hat{u}, R)& = 2 \pi (\hat{u} \cdot \hat{r}) \int \limits_0^R \int \limits_0^\pi \frac{r' \cos(\theta')}{\sqrt{r^2+r'^2 - 2 r r' \cos(\theta')}} \, r'^2 \sin(\theta') \, \mathrm{d} \theta' \, \mathrm{d} r' \\
&= 2 \pi (\hat{u} \cdot \hat{r}) \int \limits_0^R \int \limits_{-1}^1 \frac{r'^3 t}{\sqrt{r^2+r'^2 - 2 r r' t}} \, \mathrm{d} t \, \mathrm{d} r' \, .
\end{align}
Integration by parts yields
\begin{align}
f(\vec{r},\hat{u}, R) &= \frac{2 \pi (\hat{u} \cdot \hat{r})}{3r^2} \int \limits_0^R r' \left[(r+r')(r^2-r r' + r'^2) - \left|r - r'\right|(r^2 + r r' + r'^2)\right] \, \mathrm{d} r' \\
&= \frac{2 \pi (\hat{u} \cdot \hat{r})}{3r^2} \int \limits_0^R r' \begin{cases} 2r'^3 & , r' < r \\ 2r^3 & , r' \geq r \end{cases} \, \mathrm{d} r'
\end{align}
and the final result is
$$ f(\vec{r},\hat{u}, R) = \frac{2 \pi R^3 (\hat{u} \cdot \hat{r})}{15} \frac{r}{R} \begin{cases} 5 - 3 \frac{r^2}{R^2} & , r < R \\ 2 \frac{R^3}{r^3} & , r \geq R \end{cases} . $$
In particular,
$$ \int \limits_{B_R(0)} \frac{y'}{\left|\vec{r} - \vec{r}'\right|} \, \mathrm{d}^3 \vec{r}' = f(\vec{r},\hat{e}_2, R) = \frac{2 \pi R^2 y}{15} \begin{cases} 5 - 3 \frac{r^2}{R^2} & , r < R \\ 2 \frac{R^3}{r^3} & , r \geq R \end{cases} . $$