As much as I love the P51, and is a running joke in the family that I like the P38 so much, that I make everyone in my family know they use twin Allison V1710 engines, I will grudgingly say that the P51 is a better fighter. As far as a better aircraft overall, I'd have to give it to the P51 because of cost only. If cost wasn't a concern, then I'd say the P38 was the better choice overall.
There were several reasons they weren't used in the European theater, mostly due to bad circumstance. First, If you remember, the first batches of the P38's sent to England were early models, and they were not given superchargers. At that time, superchargers were a top secret thing, and they were afraid that the technology would be captured by the Germans if Germany invaded England. Because of that, they severely lacked power. England rejected them because they just didn't have enough power at altitude for that reason. Second, The British demanded they make several changes, like not wanting the propellers to rotate the same direction for commonality of parts. and as a third strike against them being used in the European theater was the fact they didn't have dive flaps. We all know about the compressibility issues with the P38. In a dive, the P38 would reach subsonic speeds, the tail would flutter, and the P38 would go into a dive with all control stuck. The retrofit flaps were sent out, but the ones sent to England were shot down by an RAF pilot due to mistaken identity. So, many of the early P38's in the European theater were not quite up to spec. By the time the P51's came, the P38's already had a bad reputation and were slowly phased out.
Now, in the Pacific theater, they worked just great. The twin engines helped bring many pilots home, the flaps worked fine, and they had superchargers. The P38 made for a fine interceptor. By that time, air tactics worked well. Although the Japanese Zero could out turn it during a dogfight, the P38 opened up other tactical options that other planes just could not do. In North Africa, they fared better, and withstood the sandy environment very well compared to other planes.
To directly compare the two.... both were quite fast. I believe the P38 could out climb a P51, they both dove well, The P38 was a better weapons platform overall since there are no convergence points on a P38. The P38 had more pilot workload than the P51. If there was a hypothetical dogfight between 50 of each planes, I think it would be a coin toss as to who would come out the winner. If there was a hypothetical bombing runs, Again it would be 50/50. For long range, they both could go pretty far.. P38's also have always had a type of "bubble canopy" which didn't come until later versions of the P51. But, when you factor in cost, It would be P51 hands down.
Which wold I want fly? I'd prefer the P-38J-25-LO (with dive flaps). If I was deciding which plane to be in my inventory for a war, it would be the P51. Which plane is better? Well, that's like asking which car is better... neither of those two planes are a Yugo.