No, you can't. Note that:
Try (to do sth) = Cố gắng.
Try (doing sth) = Thử.
english grammer you can interchange. co gang and thu are slightly different but in the test question and speaking in Vietnamese you can with slight adjustment use lam thu, ie to try, to attempt.
Could this have started as có gắng để? and became cố gắng để over time? because "having an effort in order to" seems to match up with the meaning pretty well. In fact, i thought it said có instead of cố when i first read this.