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 $p_0$ be the largest integer such that $H^{p_0}(Y,\mathbb{Q})$ is nonzero, where $Y$ is the fiber. 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 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$. EDIT: What I refer to as the "Lefschetz hyperplane theorem" is more properly the "Andreotti-Frankel" theorem.