You ask, "How can the linguist be sure that grammaticality is not just the test subject's dialect?"
It sounds like you're making an unwarranted assumption in that question. You can't be sure that you're not just learning about the test subject's dialect. In fact, it's just the opposite: no matter what you do, you are just learning about the test subject's dialect — or about one of their dialects, if they're fluent in several. And the way to do good fieldwork is just to accept that fact and work with it. You start with the speech of a single town (or family, or person), you note down variation when you run across it, and you gradually widen your sights from there.
It's important to remember here that everyone speaks a dialect. For instance, there is no such thing as "pure," non-dialectal English. And this means that, strictly speaking, "grammaticality" is always just "grammaticality in a particular dialect." When a linguist says a construction is "grammatical in English," what they really mean is, "It's grammatical in the American and British dialects that are culturally dominant right now in the anglophone world." And in fact, to be really pedantically correct, they'd have to say "It's grammatical in the personal idiolects of most or all of the people we've surveyed who belong to the American and British dialect groups that are culturally dominant right now in the anglophone world." Which is a bit of a mouthful — you can see why someone might just say "It's grammatical in English" instead.
Also, as jlovegren points out, there are ways of getting a decent idea of how widespread a construction is. You talk to different people, from different regions. You take advantage of your consultants' metalinguistic awareness: someone in Philadelphia will tell you "Oh, yeah, they talk funny in Pittsburgh," and then you know to be on the lookout for especially big dialect differences between the two cities. Sometimes you can pick a particular construction and ask "Do people in other towns say this too?" and someone will say "No, actually, whenever I say this outside my home town, I get funny looks," and that's an even stronger indication that you're looking at a construction that's limited to certain dialects. Even better, some people are bi- or tri-dialectal, and can tell you things like "Where I was born they say this, but where I grew up we say this, and on TV what they say is this."
Ultimately, though, you can never be absolutely certain you haven't missed some bit of variation. If I can elicit a construction from a thousand different people, covering all the major dialect regions I'm aware of, there's still a miniscule sliver of a chance that the thousand-and-first person will say "No, I would never say that, that's totally wrong." The only consolation here is that any natural science has the same problem. All the terrestrial life forms we've found so far are carbon-based, but it's still logically possible that someday we'll turn over a rock and find a bunch of silicon-based ones. The strongest conclusion we can ever draw about anything outside of mathematics is "That hasn't happened yet, and we'd be incredibly surprised if it ever did." I'd be incredibly surprised to find a monolingual English speaker from a major American city who didn't say "S + [be] + VERBing," but you know, it's still technically possible that someday I will.