In git 26.0.2 I was able to perform these steps:
git worktree add --no-checkout ../test_git26 git26
cd ../test_git26
git sparse-checkout init --con
git sparse-checkout set Q/
ls
This ended nicely with one directory in worktree :

Exactly same steps with git 27.0.0, ended with empty worktree.
My question is this: Do these steps make sense and should work with git 28, or I'm doing wrong.
Thanks Boaz
It seems that in git 28 (didn't check 27) you need to checkout after setting sparse-checkout patterns. It it not clear to me why it is not needed in git 26. So the full code is like this:
The only problem with this solution is that checkout is time consume operation, so, in more complex flows, when you just need to modify sparse-checkout pattern, you don't need if checkout is required or not.