I prove here that $\prod_{i=1}^n (x-a_i)^2 + d$ is irreducible over $\mathbf{Q}$ whenever the $a_i$ are distinct integers, $n\ge 6$, and $d$ is squarefree, $d>1$, and $d\not\equiv 3\pmod{4}$.
The hypotheses on $d$ ensure that the ring of algebraic integers in $\mathbf{Q}(\sqrt{-d})$ is $\mathbf{Z}[\sqrt{-d}]$, and that the only units in this ring are $\pm 1$. Write $f(x):=\prod_{i=1}^n (x-a_i)$, and let $\alpha$ be a root of $f(x)^2+d$, so that $\beta:=f(\alpha)$ satisfies $\beta^2=-d$. Suppose that $f(x)^2+d$ is reducible over $\mathbf{Q}$, so that $[\mathbf{Q}(\alpha):\mathbf{Q}]<\deg(f(x)^2+d)=2n$. Since $$[\mathbf{Q}(\alpha):\mathbf{Q}]=[\mathbf{Q}(\alpha):\mathbf{Q}(\beta)]\cdot [\mathbf{Q}(\beta):\mathbf{Q}] = 2[\mathbf{Q}(\alpha):\mathbf{Q}(\beta)],$$
it follows that $[\mathbf{Q}(\alpha):\mathbf{Q}(\beta)]<n$, so that $f(x)-\beta$ is reducible over $\mathbf{Q}(\sqrt{-d})$. Write $f(x)-\beta=g(x)h(x)$ with $g,h$ nonconstant polynomials in $\mathbf{Q}(\sqrt{-d})[x]$. Since $f(x)-\beta$ is monic, we may assume that both $g$ and $h$ are monic.
Since $f(x)-\beta$ is a monic polynomial whose coefficients are algebraic integers, all of its roots are algebraic integers. Therefore both $g$ and $h$ are monic polynomials all of whose roots are algebraic integers, so the coefficients of $g$ and $h$ are algebraic integers; since these coefficients are also in $\mathbf{Q}(\sqrt{-d})$, it follows that $g$ and $h$ are in $\mathbf{Z}[\sqrt{-d}][x]$.
Now substitute $x=a_i$ into the identity $f(x)-\beta=g(x)h(x)$, to get $-\beta=g(a_i)h(a_i)$. Hence $g(a_i)$ is an element of $\mathbf{Z}[\sqrt{-d}]$ which divides $\beta$, so taking norms gives $N(g(a_i))\mid N(\beta)=d$. Since $d$ is squarefree, the only elements of $\mathbf{Z}[\sqrt{-d}]$ whose norm divides $d$ are $\pm 1$ and $\pm\sqrt{-d}$. Thus $g(a_i)\in\{\pm 1,\pm\sqrt{-d}\}$.
First suppose that $g(a_i)$ takes the same value (call it $c$) for every $i$. Then $g(x)-c=f(x)G(x)$ for some $G(x)\in\mathbf{Z}[\sqrt{-d}][x]$, which is impossible since $0<\deg(g)<\deg(f)$.
Hence there exist $i,j$ with $g(a_i)\ne g(a_j)$. Since $n\ge 6$, it follows that there exist $r,s$ for which $g(a_r)\ne g(a_s)$ and $a_r\ge a_s+3$: for, this is clear if $\lvert a_i-a_j\rvert\ge 3$, and if $\lvert a_i-a_j\rvert<3$ then there exists $k$ such that $\lvert a_i-a_k\rvert\ge 3$ and $\lvert a_j-a_k\rvert\ge 3$, and we must have either $g(a_i)\ne g(a_k)$ or $g(a_j)\ne g(a_k)$.
Finally, $a_r-a_s$ divides $g(a_r)-g(a_s)$ in $\mathbf{Z}[\sqrt{-d}]$. Since $a_r-a_s$ is an integer $\ge 3$, and $g(a_r),g(a_s)$ are distinct elements of $\{\pm 1, \pm\sqrt{-d}\}$, this is impossible.