Update: I made a mistake. The script works fine from Arcmap. it writes output to scratch.gdb.
Update 2: I also found out that none of my published models can write into scratchGDB. They are okay if they need to write into scratch folder. I tried "feature class to feature class" and it writes shapefile into scratch folder but refuses to write feature class in scratch GDB.
Update 3: wnen script tries to write into ScratchGDB it gives me the following error:
Error executing tool. Upload_and_Visualize_DWG Job ID: j9605b3b83e15414eaff7f14cd9b81833 : ERROR 000210: Cannot create output c:\arcgisserver\directories\arcgisjobs\stopo\upload_test_2_gpserver\j9605b3b83e15414eaff7f14cd9b81833\scratch\scratch.gdb\A44755_F1_C454_350_Polyline Failed to execute (Feature Class to Feature Class). Failed to execute (Model63). Failed to execute (Upload_and_Visualize_DWG).
So looks like it creates job folder where puts DWG file, then it tries to execute Feature class to feature class and fails to write output into scratch.gdb.