Maybe let me try to synthesize my comments into an answer. All of this is contained in Raskin's beautiful paper arxiv.org/abs/1611.04937 on Whittaker categories. Convention: We work here in the derived world, i.e., all our categories are assumed pretriangulated dg (equivalently one can take stable $\infty-$categories).
Let $LG$ be the loop group of $G$, considered as a group ind-scheme. Convolution endows the category of D-modules $D(LG)$ with the structure of a monoidal category, and we can consider module categories $C$ for $D(LG)$. Two important examples:
- The category of D-modules $D(X)$ on an ind-scheme $X$ with a $LG$ action.
- The category $\hat{g}\operatorname{-mod}$ of representations of the affine Lie algebra.
The $D(LG)$ action on the first example is relatively straightforward to construct, but the second example merits some explanation. The easiest way to see that there should be such an action is to interpret objects $\hat{g}\operatorname{-mod}$ as D-modules on $LG$ weakly equivariant for the left $LG$ action. Such objects are preserved by the right action of $LG$, and this induces the desired action. (Making this precise is very technical, and I will avoid saying more about it.)
More generally, you can include a level here; this is very useful but doesn't alter anything I will say below so I suppress it.
Now take the subgroup $LN$ of $LG$, and choose a nondegenerate character $\chi$ of $LN$, just as you would for Drinfeld-Sokolov. For any category $C$ as above, we define the Whittaker category $\operatorname{Whit}(C)$ to be the category of $(LN,\chi)$-equivariant objects in $C$. More precisely, it is $\operatorname{Hom}_{D(LN)}(\operatorname{Vect},C)$, where the action on $\operatorname{Vect}$ is twisted by $\chi.$ For $C\cong D(X)$, this recovers exactly D-modules on $X$ which are $(LN,\chi)$-equivariant.
There is also a dual construction, which I denote by $\operatorname{Whit}_{co}(C),$ given by Whittaker coinvariants, i.e., $C\otimes_{D(LN)}\operatorname{Vect}.$ Raskin proves in the aforementioned paper that
$$\operatorname{Whit}(C)\cong\operatorname{Whit}_{co}(C).$$
As $\operatorname{Whit}_{co}(C)$ is a category of coinvariants, it comes with a natural functor from $C$. So the equivalence between invariants and coinvariants gives us a natural functor $C\rightarrow\operatorname{Whit}(C)$ as well, which we call !-averaging and denote by $\operatorname{Av}_!$. (For $C=D(X)$ it can be defined explicitly as a $!$-pushforward of D-modules, but it is not a priori obvious that this $!$-pushforward is well defined.)
Now what happens for $C\cong\hat{g}\operatorname{-mod}$?
In this case, there is an equivalence $\operatorname{Whit}(\hat{g}\operatorname{-mod})\cong\mathcal{W}\operatorname{-mod},$ for $\mathcal{W}$ the W-algebra. Furthermore, the functor $\operatorname{Av}_!:\hat{g}\operatorname{-mod}\rightarrow\mathcal{W}\operatorname{-mod}$ is exactly the operation of Drinfeld-Sokolov reduction.
So this provides a geometric interpretation of Drinfeld-Sokolov reduction. Let me give one quick (slightly silly) application of this framework. Denote the affine Grassmannian of $G$ by $\operatorname{Gr}$. Then we have a global sections functor $D(\operatorname{Gr})\rightarrow\hat{g}\operatorname{-mod}.$ Because this functor is $LG$-equivariant, it gives a functor
$$\operatorname{Whit}(D(\operatorname{Gr}))\rightarrow\operatorname{Whit}(\hat{g}\operatorname{-mod})$$
such that the two compositions
$$D(\operatorname{Gr})\rightarrow\operatorname{Whit}(D(\operatorname{Gr}))\rightarrow\operatorname{Whit}(\hat{g}\operatorname{-mod})$$
and
$$D(\operatorname{Gr})\rightarrow\hat{g}\operatorname{-mod}\rightarrow\operatorname{Whit}(\hat{g}\operatorname{-mod})$$
are equivalent. So for any D-module $M$ on $\operatorname{Gr}$, the Drinfeld Sokolov-reduction $\operatorname{DS}(\Gamma(M))$ only depends on the image of $M$ inside $\operatorname{Whit}(\operatorname{Gr})$ (which is a small and pretty well understood category.)