How are you attempting to set up your imac, through airports wireless utility accessed through your Macbook, or via the network set up of the imac itself - use the former not the latter. Make sure your imac Mac address is listed along with the mac addresses of your other mac connected devices. Put your imac top of the list.
Given your previous attempts I would also flush the following on your imac
DNS, interface parameters, TCP, and ARP. And try the following first to isolate your imac's wireless adapter as a possible fault.
Connect your imac to modem using ethernet. test your ethernet interface is working and you can obtain the internet ok
Plug the ethernet cable back into the airport from your modem.
Turn on your macbook and using an admin login, set up an adhoc network called imac test, give it a wep password.
Disconnect your Macbbok from the airport wireless, then ask it to connect to the adhoc network so it is broadcasting.
Using your wireless on your imac scan for it and see if you can connect.
If all is well. Reboot both machines, and retest the adhoc connection as before.
Remember to log in with full admin privileges on both machines whilst setting up and testing.
If you have any trouble connecting your adhoc then check for signal compatibility issues in the wireless adapter property settings on both machines, ie mode, channel, signal strengths, roaming aggressiveness etc.
If you still have problems with the adhoc - have your wirelss card changed in your imac
In writing this I have made no assessment of your networking skills, which may be vastly superior to my own, but sometimes a fresh perspective can help. This is what I would do if it were me, but its your time and your call. I am aware you might have done this adapter elimination process already, in which case sorry to have inconvenienced you with the time it took you to read this. best regards, Ct