I have a set of sram xx1 carbon cranks that are DUB wide. My bike (2023 Specialized Epic Evo) is DUB crank 52mm chainline. If I add BB spacers to the DUB wide crank and use a 6mm offset chainring will this achieve the original 52mm chainline? Also, would this cause any issues or downgrades to performance?
Presuming you have FC-XX-1-C2/00.6118.608.001 it shouldn't be a problem to do this with a 6mm offset ring. I believe that is the only permutation of XX1 DUB Wide, but SRAM often makes it difficult to corroborate that kind of thing. Specifically, if an 8-bolt DM variant exists now or later, you'd need an 8-bolt 6mm offset ring for it, and that doesn't exist at present AFAIK.
Spacer configuration with DUB Wide cranks is a function of the shell type, presence or absence of a chain guide, and nothing else. Target chainline is immaterial and is configured only by the ring offset. If the cranks came from somewhere else and you want to make sure you have the right spacers, look it up in the SRAM DUB Cranksets and Bottom Brackets User Manual.