The simplest option for loading DDS files is probably to use the open source library that Microsoft provide – https://github.com/Microsoft/DirectXTK. That doesn’t include functionality to turn them upside down when loading them though.
If you really want to do it manually, then take a look at https://docs.microsoft.com/en-us/windows/win32/direct3ddds/dx-graphics-dds-pguide which documents the file format. It’s not a simple file format though.
For example, the pixel data for the texture can be in a wide variety of formats, including things like BC7 compressed data (which is intended to be stored compressed in GPU memory, and get decompressed on the fly when read by the GPU). There’s often data for more than one mipmap in the file too.
For compressed pixel formats like BC7, turning the texture upside down at load time isn’t really practical. In addition, the compression is lossy, which makes it a bad choice for storing editable content anyway. Ideally you’d author content for the game in a losslessly compressed editable file format (e.g. .PNG or .PSD). You can then convert those source images into compressed DDS files with mipmaps for use in the game as part of the build process.
Microsoft also provide an open source library for creating DDS textures – https://github.com/microsoft/DirectXTex. That can be used to do things like loading a DDS file, turning it upside down, and saving it again, as well as the more sensible case of loading a PNG and converting it to a DDS.
As a side note, you can also easily flip a texture upside down when rendering with it, by adjusting the UV coordinates you use.