Try using setlocal enabledelayedexpansion at the start of your batch file, and !ERRORLEVEL! inside your IF. This seems to work for me:
@echo off
setlocal enabledelayedexpansion
dir nul
echo %ERRORLEVEL%
if .1.==.1. (
urklbkrlksdj - not a command
echo %ERRORLEVEL%
echo !ERRORLEVEL!
)