Can you use Halicarnassus' special ability to build the wonder or to discard the card for 3 gold?
No. The special ability can only be used to build the structure (for free). 

The rules say "build it [the card] for free", which excludes the other two cases (where you discard a card, or build a wonder stage, not the structure/card itself).

Also confirmed by the official FAQ:


  Q: Using Solomon (take a card from the discard pile and put it in play for free) or stages of Halicarnassus, can I use this card to build a Wonder stage?
  
  A: No.


It’s the same with Olympus (side A, second stage).

Only with the special ability of Babylon (side B, second stage) it is possible to build the wonder OR to discard the card OR to build it (paying its costs!).



Related threads on boardgamegeek.com:


Halicarnassus - playing from the discard - is it like playing any other card?
Mausoleum Question
The Mausoleum of Halicarnassus?
Olympus 2 Stage Wonder
Olympia board wonder - 2nd stage question