I'm trying to figure out how there's so much dirt inside the frame that the grate screws into. Can you dig that back some? Is that just surface dirt that's been washed in there and collected over the years or is it coming up from below the slab?
If you can excavate some of that dirt around the outside of the drain pipe, I'd do that, then put a fitting on it and a small piece of pipe to extend the drain right up to the bottom of the grate. That should keep the mud from under the slab out of the drain while still allowing the slab itself to drain reasonably well.
I'd also suggest snaking out the drain as you've likely got quite a bit of gunk in there.
An update based on the explanation in the comments:
Since what I saw as dirt around the drain pipe is more of a concrete "funnel". It appears that this is the location where water & dirt are bubbling up from below.
I'd suggest using some silicon caulk or epoxy as a filler around the top of the grate frame. You want something that's designed for outdoor use and can take some wear and tear, as well as remaining flexible enough to not crack in freezing weather*.
This should prevent things under the slab from working their way to the top of the slab and then down the drain.
Another possibility would be to skim the entire surface of the slab, since it's looking pretty tough, with some self-leveling cement, then coating the entire surface with an epoxy finish that's specifically designed for concrete floors. There are a variety that are designed for garage floors - these should be durable enough to hold up to a non-garage, but outdoor use. When you're applying the epoxy, cover over the screw hole in the grate frame to ensure you don't fill it, then bring the epoxy down into the frame to cover that gap.
*I'm making the assumption that you live in an area where freezing occurs. I see a couple of cracks in the slab, and the other wear on the concrete looks like it's led a bit of a rough life.