Yes, you can. Splunk 9.0 introduces the Ingest Actions feature that allows indexers and heavy forwarders to filter data. See https://docs.splunk.com/Documentation/Splunk/9.0.0/ReleaseNotes/MeetSplunk#What.27s_New_in_9.0 for more.
Heavy forwarders and indexers older than 9.0 can do event filtering using props and transforms. In the transform, a regular expression is matched against incoming events. Events that match the regex are sent to the null queue (discarded).
No Universal Forwarder can filter events.
Since every event is parsed and indexed separately, you can't "count" the events to choose only each 10th or 100th event. But you can try to calculate some value based on a message that will match given value roughly 1/n times in the long run. You could, for example, calculate hash from an event and check its last one or two digits.
But this will not give you perfect sampling ratio. And with badly chosen function your results may be skewed.