Preventing SQL Server Data Tools from Inserting Spaces in Object Names
I don't think it's possible to turn the "feature" off, but the way it works is that it interprets caps and underscores as a new word so a field in your datasource MyAttribute or my_attribute becomes a member named My Attribute.

The only way I can think of to prevent this is to have your column names all lower case without underscores in your datasource so myattribute as a column name will stay myattribute as your member name.

I'm not sure how your comparison scripts work and how you generate them, but I think you'll have to resort to either removing the space when you generate an SQL query or parsing and adding a space according to the same logic when generating your MDX. In powershell that should be fairly easy.