My thoughts are that the P-38 suffered from 4 basic faults ... until they were fixed.
1. The pilots had VERY little to no training. The P-38 required a lot of actions to get from cruise to combat ready condition. The early guys were probably shot down while trying to accomplish this task.
2. The early Allison had an issue with the intake manifold that took some months to sorts out; the solution was simple and easy, but they had to FIND it ... and did.
3. The issue with European fuel versus American fuel wasn't understood until we GOT some European fuel. After that, the "fix" was a simple jetting change.
4. The "fix" for the poor cockpit heater was also simple; use an electric heater.
The late model P-38's HAD the fixes are were dangerous opponets to any air force, Japanese or German. The cirtical mach number didn't change but WAY too much has been made of that. Had they been used as escort fighters that mach number thing would be of little import. The idea is to get the enemy fighters away from the bombers and if they dive away at high mach, the task is automatically accomplished. The enemy HAS to stay and fight at the bomber's altitude to be effective since that's where the bombers are. If they don't ... defacto mission accomplished.
The armament was always good since it didn't have to be aimed to converge. I think thay would have done just fine with pilot training and the bugs fixed. After the P-38J-20, they also had hydraulic aileron boost to materially increase the roll rate. That HAD to help.
Obviously this is a "what if," but it's a good one that hasn't been largely explored. I posulate that the late model P-38's would have been effective. As effective as the P-51's? Hard to say. They set a high mark. I think it would depend on who was using them and how they were employed. Had the same people flying the P-51's been flying the P-38's in manner to exploit the P-38's strengths, perhaps the results would have been similar. Had they been flown wrongly, perhaps not as good. The job would have gotten done.
Thing is, P-38 fan though I am, I am ALSO a big P-51 fan. So I wouldn't want to deprive the world of the immortal P-51 to achieve better P-38 success. Tough "what if" to actually wish for.