That config variable is bound to a CVar named “r.CustomDepth”, so you can try the following :
if (IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.CustomDepth")))
{
CVar->Set(ECustomDepthStencil::EnabledWithStencil, EConsoleVariableFlags::ECVF_SetBySystemSettingsIni);
}