I don't think there is a trick to it. You have to cut out the bad parts by showing something else, like a reaction shot.
Sometimes you can't even show the actor speaking the dialogue because its so bad, and you have to show the back of their head with the dialogue and really cut down on the amount of face time the actor has - if they aren't at the same caliber as the rest of your cast.