There is nothing one can set in the Finder, or via the Terminal defaults command that will prevent Finder from copying the .DS_Store files to OneDrive. At least, not that I am aware. I do not use OneDrive, but is there any settings in the OneDrive application that could filter Mac dot files?
There is a Terminal command that gets a lot of web hits:
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool True
which has absolutely no preventative effect in current macOS operating systems. Even the com.apple.desktopservices does not exist.
Your only option that I am aware is a script that checks the folder contents that you wish to copy for a .DS_Store file, removes it, and immediately begins the copy process to OneDrive. Programmatically, one can even get a list of all non-dot files in a folder and copy that list of files.