I want to prove that If for each rational $q$ the set $f^ {−1} ((q,\infty])$ is measurable then $f$ is measurable.
My attempt is the following:
if $f^{−1} ((q, \infty])$ is measurable for all $q$, then for each real $\lambda$ $f^{−1}((λ,\infty)) = \cup _{q>λ}f ^−1 ((q, \infty])$ is measurable as a countable union of measurable set.
You're on the right path. Given $r\in\mathbb R$, $\exists (q_n)\subset\mathbb Q:q_n\downarrow r$. Hence, $$f^{-1}\left(\left]r,\infty\right]\right) = f^{-1}\left(\bigcup_{n\in\mathbb N}\left]q_n,\infty\right]\right) = \bigcup_{n\in\mathbb N} f^{-1}\left(\left]q_n,\infty\right]\right)\in\mathcal F.$$
Simulatenously, you may prove that, given $p\in\mathbb Q$ then $f^{-1}\left(\left[-\infty,p\right]\right)$ is also measurable. Finally, given $s\in\mathbb R$, $\exists(p_n)\subset\mathbb Q:p_n\uparrow s$ and $$f^{-1}\left(\left[-\infty,s\right[\right) = f^{-1}\left(\bigcup_{n\in\mathbb N}\left[-\infty,p_n\right]\right) = \bigcup_{n\in\mathbb N} f^{-1}\left(\left[-\infty,p_n\right]\right)\in\mathcal F.$$