Are you working over the complex numbers? Is $X$ smooth? If so, then I believe you can use the Leray spectral sequence and the Lefschetz hyperplane theorem to quickly deduce that $\text{dim}_{\mathbb{C}}(X) \geq 2n$. Indeed, denote by $m$ the relative dimension of $X$ over $\mathbb{C}P^n$, so that the (complex) fiber dimension is $m$. Let $q$ be the largest integer such that $H^q(Y,\mathbb{Q})$ is nonzero, where $Y$ is the fiber. Since the fiber is a smooth, complex, affine algebraic set of (complex) dimension $m$, then $0\leq p_0 \leq m$ by the Lefschetz hyperplane theorem. Now consider the Leray spectral sequence computing the cohomology of the total space, $H^{r}(X,\mathbb{Q})$, starting with the page whose terms are $H^q(\mathbb{C}P^n,H^p(Y,\mathbb{Q}))$ -- I am using that $\mathbb{C}P^n$ is simply connected. In particular, for $q=2n$ and for $p=p_0$, the term is $$H^{2n}(\mathbb{C}P^n,\mathbb{Q})\otimes_{\mathbb{Q}}H^{p_0}(Y,\mathbb{Q}),$$ which is nonzero by hypothesis. In fact there is no nonzero term of higher $p$-degree or $q$-degree, hence there is no nonzero differential coming into or out of this term at any stage of the spectral sequence. Therefore $H^{2n+p_0}(X,\mathbb{Q})$ is nonzero. On the other hand, since $X$ is affine, we can use the Lefschetz hyperplane theorem once again to conclude that $H^d(X,\mathbb{Q})$ is zero for $d$ strictly larger than $\text{dim}_{\mathbb{C}}(X)$. Thus $n+m \geq 2n+p_0 \geq 2n$, so that $\text{dim}(X) \geq 2n$. (I guess there was no need to find an upper bound on $p_0$.) EDIT: What I refer to as the "Lefschetz hyperplane theorem" is more properly the "Andreotti-Frankel" theorem.