EDIT
To bind a command directly in the `magit-status-mode-map`, bind it as follows using `define-key`:
```
(define-key magit-status-mode-map "G" 'counsel-projectile-rg)
```
I have bound it under `G` as `g` is already used as a prefix command in the magit-status buffer.
END EDIT
You can add a transient suffix with the following line of code:
```
(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg))
```
read the docstring of `transient-insert-suffix` for an explanation.
There is also the command `transient-append-suffix` which works similarly.
Here I am adding the command `counsel-projectile-rg`, which I use myself for this case (well actually I am just using the Spacemacs key-sequence `SPC /`), and which I can really recommend. There are equally good alternatives for [helm](https://emacs-helm.github.io/helm/), [consult](https://elpa.gnu.org/devel/consult.html) and probably more... also for other backends like `grep`, `ag` etc...