It is not clear from the question whether debug mode refers to:
- Whether the app is debuggable or not
- Whether the app is currently being debugged (e.g. over ADB)
The first is covered by CommonsWare’s answer:
boolean isDebuggable = 0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE);
The second is:
boolean isBeingDebugged = android.os.Debug.isDebuggerConnected()
https://developer.android.com/reference/android/os/Debug.html#isDebuggerConnected()