The mention of "talking like a dentist" comes when Jack is forced to explain to Algernon why he is Ernest in the country but Jack in the city. The comment and its surrounding dialogue contain puns and double-meanings, and refers directly to Jack's deception.
Algernon. Yes, but... your small Aunt Cecily... calls you her dear uncle. Come, old boy, you had much better have the thing out at once.
Jack. My dear Algy, you talk exactly as if you were a dentist. It is very vulgar to talk like a dentist when one isn’t a dentist. It produces a false impression.
Algernon. Well, that is exactly what dentists always do.
(Wilde, The Importance of Being Earnest, gutenberg.org)
The puns here are fairly obvious; Algernon asks Jack to "have the thing out at once," and Jack responds that Algernon is "talking like a dentist," meaning that to "have the thing out" refers to having a tooth pulled. Because Algernon is not a dentist, to speak in a dental fashion "creates a false impression," as appearing to be someone else. Algernon correctly comments that dentists always create "false impressions," meaning dental impressions, which are the basis for false teeth.
Under this humorous banter lies the root of the issue, though: Jack, slightly ashamed of being caught in his lie, tries to change the subject by claiming that Algernon is speaking like something he is not, when it is Jack who is being deceptive. It is not the speech of dentists that Jack claims is vulgar, but the deception of speaking like a dentist when one is not a dentist. Algernon refuses to take the bait, and continues to pry into Jack's secrets. Jack claims that talking like a dentist (taking on airs as someone else) is vulgar, when it is Jack himself who is pretending to be someone else. His comment is therefore hypocritical (although it comes out that Algernon is involved in a similar deception).