Once again, here's a "best plane" thread, which ignores economics.
The P-38 is an excellent plane. So is the P-51. Perhaps, in a 1 on 1, the P-38 might have a slight advantage over the P-51, however.....
A P-51D cost about $50,000
A P-38L cost about $125,000
So tell me--are two P-38L's going to be as effective as 5 P-51D's???
Not likely!
Also unmentioned is time required for construction--the P-51 took fewer than half the man hours to build, meaning losses could be replaced that much faster.
Further adding to the P-38's woes, the supply situation for the P-38 was a headache compared to that of the P-51. Each P-38 required two sets of parts for every major component, and these had to be shipped all the way from the USA. OTOH, the P-51 required just 1 set of major parts per plane, and these parts were mostly easily available in Britain.
In the pacific, where the supply situation was exactly the opposite of that in Britain (American parts were easier to come by in the PAC), and losses were nowhere as severe, the P-38 performed as the excellent fighter it was.
The P-38 was not well suited to the mission requirements in Europe. It cost too much and was too hard to keep operational. The P-51 was simply better suited to the conditions. Likewise, the P-38 was better suited to the conditions in the Pacific.
As for which was actually the better plane? Depends on whether you're in Europe or the Pacific

J_A_B