Make Raycast ignore Terrain

How could i get my Ray to ignore the terrain colidier?

Ray ray;
ray = Camera.main.ScreenPointToRay(Input.mousePosition);

 if(Physics.Raycast(ray ,out hit))
{		
SelectedGameObject = hit.collider.gameObject;
SelectedGameObject.renderer.material.color = Color.blue;
Debug.Log("Collision Detected : " + hit.collider.gameObject.name + " at " + hit.collider.gameObject.transform.position);

Put the terrain on a particular layer, and use a layermask in the raycast that ignores that layer.

–Eric