You can restrict the audience of your posts on Mastodon using post visibility settings. You can set each post's visibility separately if you want, and you can also choose a default visibility.
There are four or five different visibility settings which let you control who can see your posts and how easily they can be discovered.
Instructions on how to set Mastodon's post visibilities (and lots of questions answered about this feature) at:
➡️ fedi.tips/who-can-see-my-posts…
Who can see my posts and replies in Mastodon? How do I choose post visibility settings? How do I send DMs in Mastodon? | Fedi.Tips – An Unofficial Guide to Mastodon and the Fediverse
An unofficial guide to using Mastodon and the Fediversefedi.tips