How many rational distances can there be between N points in the plane?

Let S be a subset of R^2 such that the distance between any two points in S is a rational number. Can we conclude that S is not topologically dense?

S doesn’t have to be finite; one could have S be the set of rational points on a line, for instance. But this appears to be almost the only screwy case. One can ask, more ambitiously:

Is it the case that there exists a curve X of degree <= 2 containing all but 4 points of S?

Terry explains in his post how to show something like this conditional on the Bombieri-Lang conjecture. The idea: lay down 4 points in general position. Then the condition that the 5th point has rational distances from x1,x2,x3, and x4 means that point lifts to a rational point on a certain (Z/2Z)^4-cover Y of P^2 depending on x1,x2,x3,x4. (It’s the one obtained by adjoining the 4 distances, each of which is a square root of a rational function.)

With some work you can show Y has general type, so under Lang its rational points are supported on a union of curves. Then you use a result of Solymosi and de Zeeuw to show that each curve can only have finitely many points of S if it’s not a line or a circle. (Same argument, except that instead of covers of P^2 you have covers of the curve, whose genus goes up and then you use Faltings.)

It already seems hard to turn this approach into a proof. There are few algebraic surfaces for which we can prove Lang’s conjecture. But why let that stop us from asking further questions?

Question: Let S be a set of N points on R^2 such that no M are contained in any line or circle. What is the maximal number of rational distance among the ~N^2 distances between points of S?

The Erdos-Ulam problem suggests the answer is smaller than N^2. But surely it’s much smaller, right? You can get at least NM rational distances just by having S be (N/M) lines, each with M rational points. Can you do better?