Update December 10, 2025
In the latest Visual Studio 2026 update (Insiders [11304.161]), Microsoft has fixed this issue!
At first glance, it might not feel like anything changed, but by going intoGo to Tools->Options->Environment->Visual Experience, there's now a new and enable the checkmark "Use compact spacing in Solution Explorer":
Which does exactly what it says: checking it reduces spacing between each item in Solution Explorer. Here's a side-by-side preview of the same directory:
AlternativelyOr, you can include the following line in your settings.json file:
"environment.visualExperience.useCompactSpacing": true
Old answer
Unfortunately, there is no actual way to make this happen. The spacing between each Solution Explorer item is because of the Solution Explorer making use of the Fluent design, which scales items more (before that update, Solution Explorer used Visual Studio 2022-style items). Microsoft is slowly making use of Fluent theme across their products, and Visual Studio is one of the biggest priorities to make it happen, and because Solution Explorer now uses Fluent theme, no configuration option is available. There is no setting to change this.
Thankfully, there is feedback on this, created immediately after the update was enrolled, and it's possible that Microsoft will add a way to either roll back the change or allow users to edit spacing, but as of now, there isn't a way to change this. I will edit this answer when there is an update.

