Show that the function f : $\mathbb{R} \rightarrow \mathbb{R}$ is measurable if $f(x) \begin{equation} = \begin{cases} 1 & \text{if $x \in \mathbb{Q}$}\\ \\ 0 & \text{if $x \notin \mathbb{Q}$} \end{cases} \end{equation}$.
Is the pre-image of f $$\{ \omega \in \Omega : I_{\mathbb{Q}}(\omega)\in (-\infty, x]\} \begin{equation} = \begin{cases} \emptyset & \text{if x < 0 }\\ \mathbb{R} \backslash \mathbb{Q} & \text{0 $\le$ x<1}\\ \mathbb{R} & \text{x $\ge$ 1} \end{cases} \end{equation}$$
and in that case, how do I use this to show that f is measurable?
You are left to show that $\mathbb R$, $\emptyset$, and $\mathbb R \setminus \mathbb Q$ are measurable.
The first two are obviously measurable, the $\sigma$-algebra of measurable sets must always include the full set and the empty set.
You are left to show that $\mathbb R \setminus \mathbb Q$ is a measurable set, and for that you can first show that $\mathbb Q$ is measurable. But $\mathbb Q$ being countable, is a countable union of singletons, that is $\mathbb Q = \bigcup_{x\in \mathbb Q} \{x\}$. And singletons $\{x\}$ are obviously measurable (to show it you need to start from the definition of the sigma-algebra $F$ of measurable sets you use).
You can generalize the whole discussion to show the following very useful two facts: