Below is a proof to show that if $f$ is a real function on a measurable space $X$ such that $\{x : f(x) \gt r\}$ is measurable for every irrational $r$, then $f$ is measurable.
Suppose $\{x \in X | f(x) \gt r\}$ is measurable, $r\in \mathbb{R\setminus Q}$. Let $d\in\mathbb{R}$. Then for each $n$ $\exists$ $r_n\in\mathbb{R\setminus Q}$ such that $r_n \gt d$. Then $ \{x | f(x) \gt d\} = \bigcup_{n=1}^\infty \{x | f(x) \gt r_n\}.$ Since $\{x | f(x) \gt r_n\} $ is measurable, $f$ is measurable.
Please, is this right?