Note that $N$ is homeomorphic to the union of $M$ with $\DeclareMathOperator{\Cyl}{Cyl}$ the mapping cylinder $\Cyl(\pi)$ of the bundle projection $\newcommand{\pa}{\partial}$ $\pi:\pa M\to X$. Denote by $M^\circ$ the interior of $M$ Now observe that from the Poincare Duality for $(M,\pa M)$ we have $$ H^{n-k}_{dR}(M)\cong H^k_{dR}(M^\circ) \cong H^k_{cpt}(M^\circ). $$ The extension by $0$ defines a morphism $$ H^k_{cpt}(M^\circ)\to H^k_{cpt}(N)\cong H^k(N). $$ **Comment.** Above I assumed that $H^\bullet_{dR}(M,\pi)=H^\bullet_{dR}(M)$. Now observe that $$ H^{n-k}_{dR}(M)\cong H_k(M,\pa M). $$ From the excision property of homology we deduce that the inclusion $$ (M,\pa M)\hookrightarrow (N,\Cyl \pi) $$ induces an isomorphism $$ H_k(M,\pa M)\cong H_k(N,\Cyl \pi). $$ If $H_k(X)=H_{k-1}(X)=0$, then $H_k(N)\cong H_k(N,\Cyl \pi)$.