I am a postgraduate student of physics. While doing some research on Poincare's work on the integrability of the three body problem, I came up with the following problem (which I feel unable to handle, possibly due to my insufficient background in general topology):

Let $X$ be a topological space and consider a non-constant, continuous function $f:X\to\mathbb{R}$ ( where $\mathbb{R}$ is considered with its usual euclidean topology). Is the inverse image of the rational values $f^{-1}(\mathbb{Q})\subseteq X$, always a dense subset of the domain $X$?

I would appreciate any help. Sorry in advance if this is not really research level.